Class LogicGate

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    NonStrictLogicGate

    public class LogicGate
    extends Transformer

    Produce an output token on each firing with a value that is equal to the specified logic operator of the input(s). The functions are:

    • and: The logical and operator. This is the default function for this actor.
    • or: The logical or operator.
    • xor: The logical xor operator.
    • nand: The logical nand operator. Equivalent to the negation of and.
    • nor: The logical nor operator. Equivalent to the negation of or.
    • xnor: The logical xnor operator. Equivalent to the negation of xor.

    NOTE: All operators have a single input port, which is a multiport, and a single output port, which is not a multiport. All ports have type boolean.

    This actor does not require that each input channel have a token upon firing. As long as one channel contains a token, output will be produced. If no input tokens are available at all, then no output is produced. At most one token is consumed on each input channel.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Paul Whitaker
    Pt.AcceptedRating:
    Green (pwhitake)
    Pt.ProposedRating:
    Green (pwhitake)
    • Field Detail

      • logic

        public StringParameter logic
        The function to compute. This is a string-valued attribute that defaults to "and".
      • _function

        protected int _function
        An indicator for the function to compute. Valid values are _AND, _OR, and _XOR.
      • _negate

        protected boolean _negate
        True if the intermediate results should be negated.