Class ArrayToElements

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

    public class ArrayToElements
    extends Transformer

    An actor that disassembles an ArrayToken to a multiport output.

    On each firing, this actor reads an ArrayToken from the input port and send out each element token to each channel of the output port. If the width of the output port (say, n) is less than the number of elements in the array (say m), then the first n elements in the array will be sent, and the remaining tokens are discarded. If n is greater than m, then the last n-m channels of the output port will never send tokens out.

    This actor is polymorphic. It can accept ArrayTokens with any element type and send out tokens corresponding to that type.

    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Ye Zhou
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (zhouye)
    • Method Detail

      • _defaultTypeConstraints

        protected java.util.Set<Inequality> _defaultTypeConstraints()
        Do not establish the usual default type constraints. Instead, the type of the output port is constrained to be no less than the type of the elements of the input array (set in the constructor of this class).
        Overrides:
        _defaultTypeConstraints in class TypedAtomicActor
        Returns:
        A set of type constraints
      • _customTypeConstraints

        protected java.util.Set<Inequality> _customTypeConstraints()
        Add a type constraint for backward type inference that forces the input to be an array of which the elements have a type greater than or equal to the output port. If backward type inference is disabled, this method returns an empty set.
        Overrides:
        _customTypeConstraints in class TypedAtomicActor
        Returns:
        A set of inequalities.
        See Also:
        ArrayOfTypesFunction