* gate.st * * Implements the class Gate and its subclasses * * by Ricardo Szmit * * Last update: 03.04.94 Class Gate Object inputs Methods Gate 'all' new inputs <- List new | connect: aGate inputs addLast: aGate | numberOfInputs ^inputs size | trueInputs ^( inputs select: [ :gate | gate output ] ) size ] Class And Gate Methods And 'all' output ^self trueInputs = self numberOfInputs ] Class Or Gate Methods Or 'all' output ^self trueInputs > 0 ] Class Xor Gate Methods Xor 'all' output ^self trueInputs = 1 ] Class One Gate Methods One 'all' output ^true ] Class Zero Gate Methods Zero 'all' output ^false ] Class Nand And Methods Nand 'all' output ^super output not ] Class Nor Or Methods Nor 'all' output ^super output not ] Class Nxor Xor Methods Nxor 'all' output ^super output not ]