Class LogicFunction

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

    @Deprecated
    public class LogicFunction
    extends Transformer
    Deprecated.
    Use LogicGate instead.

    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 1.0
    Version:
    $Id$
    Author:
    Paul Whitaker
    Pt.AcceptedRating:
    Green (pwhitake)
    Pt.ProposedRating:
    Green (pwhitake)
    • Field Detail

      • function

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

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

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

        protected static final int _AND
        Deprecated.
        Perform a logical AND.
        See Also:
        Constant Field Values
      • _XOR

        protected static final int _XOR
        Deprecated.
        Perform a logical XOR.
        See Also:
        Constant Field Values
    • Constructor Detail

      • LogicFunction

        public LogicFunction​(CompositeEntity container,
                             java.lang.String name)
                      throws NameDuplicationException,
                             IllegalActionException
        Deprecated.
        Construct an actor with the given container and name. Set the logic function to the default ("and"). Set the types of the ports to boolean.
        Parameters:
        container - The container.
        name - The name of this actor.
        Throws:
        IllegalActionException - If the actor cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        Deprecated.
        Override the base class to determine which function is being specified. Read the value of the function attribute and set the cached value appropriately.
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the function is not recognized.
      • _updateFunction

        protected BooleanToken _updateFunction​(BooleanToken in,
                                               BooleanToken old)
                                        throws IllegalActionException
        Deprecated.
        Calculate the function on the given arguments.
        Parameters:
        in - The new input value. Should never be null.
        old - The old result value, or null if there is none.
        Returns:
        The result of applying the function.
        Throws:
        IllegalActionException - If thrown by BooleanToken operations.