Class LookupTable

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

    public class LookupTable
    extends Transformer

    Output to the output port the value in the array of tokens specified by the table parameter at the index specified by the input port. The index must be an integer. If the index is out of range, no token produced.

    LookupTable is different from ArrayElement in that in ArrayElement, the array is read in as input, and the index is a parameter, In LookupTable, the array is a parameter, and the index is read in as an input.

    Note that there are three similar actors here:

    LookupTable
    array is a parameter, index is a port.
    ArrayElement
    array is a port, index is a parameter
    ArrayXXX (not yet developed)
    array and index are both ports
    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Paul Whitaker, Christopher Hylands
    See Also:
    ArrayElement
    Pt.AcceptedRating:
    Yellow (cxh)
    Pt.ProposedRating:
    Yellow (cxh)
    • Field Detail

      • table

        public Parameter table
        The table array that we look up elements in. This parameter is an array with default value {0, 1}.
    • Method Detail

      • fire

        public void fire()
                  throws IllegalActionException
        Consume at most one token from the input port and produce the element at the index specified by this token from the table array on the output port. If there is no token on the input or the token is out of range, then no output is produced.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If there is no director.