Class SequenceToArray

  • All Implemented Interfaces:
    AdditionalInformationHandler, ClassCrossReference, CleanUpHandler, CrossReference, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class SequenceToArray
    extends AbstractTransformer
    implements ClassCrossReference
    Turns a sequence of tokens into arrays with a specified length.
    In case of unspecified length (ie -1), an array containing all elements collected so far is output each time a token arrives, i.e., the internal buffer never gets reset.

    - accepts:
    - generates:

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: SequenceToArray
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        default: false
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
    -length <int> (property: arrayLength)
        The length of the output array; use -1 to output an array with all collected
        elements so far whenever a token arrives.
        default: 1
        minimum: -1
    -overlap <int> (property: overlap)
        The overlap of elements between arrays; e.g., sequence of 1,2,3,4 with length
        =2 and overlap=0 gets packaged in to (1,2),(3,4); with overlap=1, this changes
        to (1,2),(2,3),(3,4); array length option must be > 0.
        default: 0
        minimum: 0
    -array-class <adams.core.base.BaseClassname> (property: arrayClass)
        The class to use for the array; if none is specified, the class of the first 
        element is used.
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail


        public static final String BACKUP_ELEMENTS
        the key for storing the current elements in the backup.
        See Also:
        Constant Field Values
      • m_Elements

        protected List m_Elements
        the buffered elements of the array that still need to be broadcasted.
      • m_ArrayLength

        protected int m_ArrayLength
        the length of the arrays.
      • m_Overlap

        protected int m_Overlap
        the overlap in elements between arrays.
      • m_ArrayClass

        protected BaseClassname m_ArrayClass
        the class for the array.
    • Constructor Detail

      • SequenceToArray

        public SequenceToArray()
    • Method Detail

      • setArrayLength

        public void setArrayLength​(int value)
        Sets the length of the arrays.
        value - the length
      • getArrayLength

        public int getArrayLength()
        Returns the length of the arrays.
        the length
      • arrayLengthTipText

        public String arrayLengthTipText()
        Returns the tip text for this property.
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOverlap

        public void setOverlap​(int value)
        Sets the overlap of elements between arrays.
        value - the overlap
      • getOverlap

        public int getOverlap()
        Returns the overlap of elements between arrays.
        the overlap
      • overlapTipText

        public String overlapTipText()
        Returns the tip text for this property.
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setArrayClass

        public void setArrayClass​(BaseClassname value)
        Sets the class for the array.
        value - the classname, use empty string to use class of first element
      • getArrayClass

        public BaseClassname getArrayClass()
        Returns the class for the array.
        the classname, empty string if class of first element is used
      • arrayClassTipText

        public String arrayClassTipText()
        Returns the tip text for this property.
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • reset

        protected void reset()
        Resets the scheme.
        reset in class AbstractActor
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        null if everything is fine, otherwise error message