Class ArrayGenerate

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, Pausable, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, ThreadLimiter, VariablesInspectionHandler, FlowPauseStateListener, VariableChangeListener, AtomicExecution, Actor, ActorHandler, ControlActor, ErrorHandler, Flushable, InputConsumer, MutableActorHandler, OutputProducer, SubFlowWrapUp, Serializable, Comparable

    public class ArrayGenerate
    extends Branch
    implements OutputProducer
    Applies all sub-actors to the input token and generates an array from the collected output.
    Each of the branches is expected to produce at most one output token (ideally one per branch, otherwise there will be null elements in the output array).

    -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: ArrayGenerate
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -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 gets stopped in case this actor encounters an error;
         useful for critical actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console.
        default: false
     
    -finish-before-stopping <boolean> (property: finishBeforeStopping)
        If enabled, actor first finishes processing all data before stopping.
        default: false
     
    -branch <adams.flow.core.Actor> [-branch ...] (property: branches)
        The different branches that branch off and will be supplied with a copy 
        of the same object.
        default: 
     
    -num-threads <int> (property: numThreads)
        The number of threads to use for executing the branches; -1 = number of 
        CPUs/cores; 0 or 1 = sequential execution.
        default: -1
        minimum: -1
     
    -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.
        default: 
     
    Version:
    $Revision: 7842 $
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • BACKUP_OUTPUT

        public static final String BACKUP_OUTPUT
        the key for storing the output token in the backup.
        See Also:
        Constant Field Values
      • m_ArrayClass

        protected BaseClassname m_ArrayClass
        the class for the array.
      • m_OutputToken

        protected Token m_OutputToken
        the output array.
    • Constructor Detail

      • ArrayGenerate

        public ArrayGenerate()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class Branch
      • setArrayClass

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

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

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

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

        protected String checkBranch​(Actor branch)
        Checks the sub-branch.
        Overrides:
        checkBranch in class Branch
        Parameters:
        branch - the branch to check
        Returns:
        null if everything correct, otherwise the error message
      • input

        public void input​(Token token)
        The method that accepts the input token and then processes it.
        Specified by:
        input in interface InputConsumer
        Overrides:
        input in class Branch
        Parameters:
        token - the token to accept and process
      • doExecute

        protected String doExecute()
        Executes the actor.
        Overrides:
        doExecute in class Branch
        Returns:
        null if everything is fine, otherwise error message
      • hasPendingOutput

        public boolean hasPendingOutput()
        Checks whether there is pending output to be collected after executing the flow item.
        Specified by:
        hasPendingOutput in interface OutputProducer
        Returns:
        true if there is pending output
      • output

        public Token output()
        Returns the generated token.
        Specified by:
        output in interface OutputProducer
        Returns:
        the generated token
      • wrapUp

        public void wrapUp()
        Cleans up after the execution has finished.
        Specified by:
        wrapUp in interface Actor
        Overrides:
        wrapUp in class Branch