Class ArrayToSequence

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

    public class ArrayToSequence
    extends SDFTransformer

    This actor reads an array at the input and writes the array elements as a sequence to the output. The parameter arrayLength can be used to specify the length of arrays that the actor will accept. If the enforceArrayLength parameter true, then if an input array does not match arrayLength, the fire() method will throw an exception. This feature is important in domains, such as SDF, that do static scheduling based on production and consumption rates. For other domains, such as DE and PN, the enforceArrayLength parameter can be set to false, in which case the arrayLength parameter will be ignored.

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

    Since:
    Ptolemy II 0.4
    Version:
    $Id$
    Author:
    Yuhong Xiong, Marten Lohstroh
    Pt.AcceptedRating:
    Yellow (neuendor)
    Pt.ProposedRating:
    Yellow (yuhong)
    • Field Detail

      • arrayLength

        public Parameter arrayLength
        The size of the input array. This is an integer that defaults to 1.
      • enforceArrayLength

        public Parameter enforceArrayLength
        If true, then enforce the arrayLength parameter by throwing an exception if it is violated. This is a boolean that defaults to true.
    • 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 the enforceArrayLength parameter is set to true, the input is also forced to have a length equal to the arrayLength parameter. 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