Class AbstractTee

    • Field Detail

      • BACKUP_INPUT

        public static final String BACKUP_INPUT
        the key for storing the input token in the backup.
        See Also:
        Constant Field Values
      • m_Actors

        protected Sequence m_Actors
        the flow items.
      • m_InputToken

        protected transient Token m_InputToken
        the input token.
      • m_OutputToken

        protected transient Token m_OutputToken
        the output token.
      • m_MinimumActiveActors

        protected int m_MinimumActiveActors
        the minimum active actors this handler requires.
      • m_Asynchronous

        protected boolean m_Asynchronous
        whether to execute sub-actors asynchronously.
      • m_AsynchronousWorker

        protected AbstractTee.TeeSwingWorker m_AsynchronousWorker
        the swingworker in use for asynchronous execution.
    • Constructor Detail

      • AbstractTee

        public AbstractTee()
    • Method Detail

      • setSkip

        public void setSkip​(boolean value)
        Sets whether the transformation is skipped or not.
        Specified by:
        setSkip in interface Actor
        Overrides:
        setSkip in class AbstractActor
        Parameters:
        value - true if transformation is to be skipped
      • checkTeeActor

        protected abstract String checkTeeActor​(int index,
                                                Actor actor)
        Checks the tee actor before it is set. Returns an error message if the actor is not acceptable, null otherwise.
        Parameters:
        index - the index the actor gets set
        actor - the actor to check
        Returns:
        null if accepted, otherwise error message
      • checkTeeActors

        protected abstract String checkTeeActors​(Actor[] actors)
        Checks the tee actors before they are set via the setTeeActors method. Returns an error message if the actors are not acceptable, null otherwise.
        Parameters:
        actors - the actors to check
        Returns:
        null if accepted, otherwise error message
      • setActors

        public void setActors​(Actor[] value)
        Sets the actor to tee-off to.
        Parameters:
        value - the actor
      • getActors

        public Actor[] getActors()
        Returns the actors to tee-off to.
        Returns:
        the actors
      • actorsTipText

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

        public void setFinishBeforeStopping​(boolean value)
        Sets whether to finish processing before stopping execution.
        Specified by:
        setFinishBeforeStopping in interface AtomicExecution
        Parameters:
        value - if true then actor finishes processing first
      • getFinishBeforeStopping

        public boolean getFinishBeforeStopping()
        Returns whether to finish processing before stopping execution.
        Specified by:
        getFinishBeforeStopping in interface AtomicExecution
        Returns:
        true if actor finishes processing first
      • finishBeforeStoppingTipText

        public String finishBeforeStoppingTipText()
        Returns the tip text for this property.
        Specified by:
        finishBeforeStoppingTipText in interface AtomicExecution
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setStoppingTimeout

        public void setStoppingTimeout​(int value)
        Sets the timeout for waiting for the sub-flow to stop.
        Specified by:
        setStoppingTimeout in interface AtomicExecution
        Parameters:
        value - timeout in milliseconds (<= 0 for infinity)
      • getStoppingTimeout

        public int getStoppingTimeout()
        Returns the timeout for waiting for the sub-flow to stop.
        Specified by:
        getStoppingTimeout in interface AtomicExecution
        Returns:
        timeout in milliseconds (<= 0 for infinity)
      • stoppingTimeoutTipText

        public String stoppingTimeoutTipText()
        Returns the tip text for this property.
        Specified by:
        stoppingTimeoutTipText in interface AtomicExecution
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setAsynchronous

        public void setAsynchronous​(boolean value)
        Sets whether to finish processing before stopping execution.
        Parameters:
        value - if true then actor finishes processing first
      • getAsynchronous

        public boolean getAsynchronous()
        Returns whether to finish processing before stopping execution.
        Returns:
        true if actor finishes processing first
      • asynchronousTipText

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

        protected void forceVariables​(Variables value)
        Updates the Variables instance in use.

        Use with caution!
        Overrides:
        forceVariables in class AbstractControlActor
        Parameters:
        value - the instance to use
      • get

        public Actor get​(int index)
        Returns the actor at the given position.
        Specified by:
        get in interface ActorHandler
        Specified by:
        get in class AbstractControlActor
        Parameters:
        index - the position
        Returns:
        the actor
      • indexOf

        public int indexOf​(String actor)
        Returns the index of the actor.
        Specified by:
        indexOf in interface ActorHandler
        Specified by:
        indexOf in class AbstractControlActor
        Parameters:
        actor - the name of the actor to look for
        Returns:
        the index of -1 if not found
      • add

        public String add​(Actor actor)
        Inserts the actor at the end.
        Specified by:
        add in interface MutableActorHandler
        Parameters:
        actor - the actor to insert
        Returns:
        null if everything is fine, otherwise the error
      • add

        public String add​(int index,
                          Actor actor)
        Inserts the actor at the given position.
        Specified by:
        add in interface MutableActorHandler
        Parameters:
        index - the position
        actor - the actor to insert
        Returns:
        null if everything is fine, otherwise the error
        See Also:
        checkTeeActor(int, Actor)
      • remove

        public Actor remove​(int index)
        Removes the actor at the given position and returns the removed object.
        Specified by:
        remove in interface MutableActorHandler
        Parameters:
        index - the position
        Returns:
        the removed actor
      • getInternalActors

        protected Sequence getInternalActors()
        Returns the internal representation of the actors.
        Returns:
        the internal actors
      • finishedAsynchronousExecution

        protected void finishedAsynchronousExecution()
        Called by the asynchronous swingworker when finished.
      • waitForAsynchronousExecution

        protected void waitForAsynchronousExecution()
        Waits for the asynchronous execution to finish.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        adams.flow.core.Unknown.class
      • setUpTeeActors

        protected abstract String setUpTeeActors()
        Gets called in the setUp() method. Returns null if tee-actors are fine, otherwise error message.
        Returns:
        null if everything OK, otherwise error message
      • setMinimumActiveActors

        public void setMinimumActiveActors​(int value)
        Sets the minimum of (active) actors that need to be present in the tee branch.
        Parameters:
        value - the required minimum of actors
      • getMinimumActiveActors

        public int getMinimumActiveActors()
        Returns the minimum of (active) actors that need to be present in the tee branch.
        Returns:
        the required minimum of actors
      • setUpSubActors

        protected String setUpSubActors()
        Performs the setUp of the sub-actors.
        Overrides:
        setUpSubActors in class AbstractControlActor
        Returns:
        null if everything is fine, otherwise error message
      • createTeeToken

        protected Token createTeeToken​(Token token)
        Creates the token to tee-off.
        Parameters:
        token - the input token
        Returns:
        the token to tee-off
      • input

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

        public boolean hasInput()
        Returns whether an input token is currently present.
        Specified by:
        hasInput in interface InputConsumer
        Returns:
        true if input token present
      • currentInput

        public Token currentInput()
        Returns the current input token, if any.
        Specified by:
        currentInput in interface InputConsumer
        Returns:
        the input token, null if none present
      • canProcessInput

        protected boolean canProcessInput​(Token token)
        Returns whether the token can be processed in the tee actor.
        Parameters:
        token - the token to process
        Returns:
        true if token can be processed
      • processInput

        protected String processInput​(Token token)
        Processes the token normal, i.e., not in thread.
        Parameters:
        token - the token to process
        Returns:
        an optional error message, null if everything OK
      • doExecute

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

        public String execute()
        Executes the flow item.
        Specified by:
        execute in interface Actor
        Overrides:
        execute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        adams.flow.core.Unknown.class
      • output

        public Token output()
        Returns the generated token.
        Specified by:
        output in interface OutputProducer
        Returns:
        the generated token
      • 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