Class InstanceCleaner

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.Pausable, adams.core.QuickInfoSupporter, adams.core.ShallowCopySupporter<adams.flow.core.Actor>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.core.VariablesInspectionHandler, adams.db.DatabaseConnectionUser, adams.event.FlowPauseStateListener, adams.event.VariableChangeListener, adams.flow.core.Actor, adams.flow.core.ActorHandler, adams.flow.core.ControlActor, adams.flow.core.ErrorHandler, adams.flow.core.Flushable, adams.flow.core.InputConsumer, adams.flow.core.OutputProducer, adams.flow.core.SubFlowWrapUp, Serializable, Comparable

    public class InstanceCleaner
    extends adams.flow.control.AbstractControlActor
    implements adams.flow.core.InputConsumer, adams.flow.core.OutputProducer, adams.db.DatabaseConnectionUser
    'Cleanses' the tokens being passed through. The rejected tokens and rejection messages can be access via the other outputs.

    Valid options are:

    -D (property: debug)
             If set to true, scheme may output additional info to the console.
     
    -name <java.lang.String> (property: name)
             The name of the actor.
             default: InstanceCleaner
     
    -annotation <knir.core.base.BaseString> [-annotation ...] (property: annotations)
             The annotations to attach to this actor.
     
    -skip (property: skip)
             If set to true, transformation is skipped and the input token is just forwarded
              as it is.
     
    -progress (property: showProgress)
             If set to true, progress information will be output to stdout ('.').
     
    -cleaner <knir.data.cleaner.instance.AbstractCleaner [options]> (property: cleaner)
             The cleaner to apply to the data.
             default: knir.data.cleaner.instance.PassThrough
     
    -rejected <knir.flow.core.Actor [options]> (property: rejectedTokensActor)
             The actor to send the rejected tokens to.
             default: knir.flow.sink.Null -name Null
     
    -messages <knir.flow.core.Actor [options]> (property: rejectionMessagesActor)
             The actor to send the rejection messages to.
             default: knir.flow.sink.Null -name Null
     
    Default options for knir.data.cleaner.instance.PassThrough (-cleaner/cleaner):
    -D (property: debug)
             If set to true, scheme may output additional info to the console.
     
    Default options for knir.flow.sink.Null (-rejected/rejectedTokensActor):
    -D (property: debug)
             If set to true, scheme may output additional info to the console.
     
    -name <java.lang.String> (property: name)
             The name of the actor.
             default: Null
     
    -annotation <knir.core.base.BaseString> [-annotation ...] (property: annotations)
             The annotations to attach to this actor.
     
    -skip (property: skip)
             If set to true, transformation is skipped and the input token is just forwarded
              as it is.
     
    Default options for knir.flow.sink.Null (-messages/rejectionMessagesActor):
    -D (property: debug)
             If set to true, scheme may output additional info to the console.
     
    -name <java.lang.String> (property: name)
             The name of the actor.
             default: Null
     
    -annotation <knir.core.base.BaseString> [-annotation ...] (property: annotations)
             The annotations to attach to this actor.
     
    -skip (property: skip)
             If set to true, transformation is skipped and the input token is just forwarded
              as it is.
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected AbstractCleaner m_Cleaner
      the instance cleaner to use.
      protected boolean m_DatabaseConnectionUpdated
      whether the database connection has been updated.
      protected adams.flow.core.Token m_InputToken
      the input token.
      protected adams.flow.core.Token m_OutputToken
      the output token.
      protected adams.flow.core.Actor m_RejectedTokensActor
      the actor for the rejected tokens.
      protected adams.flow.core.Actor m_RejectionMessagesActor
      the actor for the rejection messages.
      • Fields inherited from class adams.flow.control.AbstractControlActor

        m_Compatibility, m_PauseStateManager, m_SetUpSubActors
      • Fields inherited from class adams.flow.core.AbstractActor

        m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
      • Fields inherited from interface adams.flow.core.Actor

        FILE_EXTENSION, FILE_EXTENSION_GZ
    • Constructor Summary

      Constructors 
      Constructor Description
      InstanceCleaner()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Class[] accepts()
      Returns the class that the consumer accepts.
      String cleanerTipText()
      Returns the tip text for this property.
      adams.flow.core.Token currentInput()
      Returns the current input token, if any.
      void defineOptions()
      Adds options to the internal list of options.
      protected String doExecute()
      Executes the actor.
      String execute()
      Executes the flow item.
      void flushExecution()
      Stops the processing of tokens without stopping the flow.
      Class[] generates()
      Returns the class of objects that it generates.
      adams.flow.core.Actor get​(int index)
      Returns the actor at the given position.
      adams.flow.core.ActorHandlerInfo getActorHandlerInfo()
      Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.
      AbstractCleaner getCleaner()
      Returns the cleaner.
      adams.flow.core.Actor getRejectedTokensActor()
      Returns the actor the rejected tokens are sent to.
      adams.flow.core.Actor getRejectionMessagesActor()
      Returns the actor to send the rejection messages to.
      String globalInfo()
      Returns a string describing the object.
      boolean hasInput()
      Returns whether an input token is currently present.
      boolean hasPendingOutput()
      Checks whether there is pending output to be collected after executing the flow item.
      int indexOf​(String actor)
      Returns the index of the actor.
      protected void initialize()
      Initializes the members.
      void input​(adams.flow.core.Token token)
      The method that accepts the input token and then processes it.
      adams.flow.core.Token output()
      Returns the generated token.
      String rejectedTokensActorTipText()
      Returns the tip text for this property.
      String rejectionMessagesActorTipText()
      Returns the tip text for this property.
      protected void reset()
      Resets the scheme.
      String set​(int index, adams.flow.core.Actor actor)
      Sets the actor at the given position.
      void setCleaner​(AbstractCleaner value)
      Sets the cleaner.
      void setRejectedTokensActor​(adams.flow.core.Actor value)
      Sets the actor to send the rejected tokens to.
      void setRejectionMessagesActor​(adams.flow.core.Actor value)
      Sets the actor to send the rejection messages to.
      String setUp()
      Initializes the sub-actors for flow execution.
      int size()
      Returns the size of the group.
      void stopExecution()
      Stops the execution.
      • Methods inherited from class adams.flow.control.AbstractControlActor

        active, canInspectOptions, check, cleanUp, destroy, firstActive, firstInputConsumer, flowPauseStateChanged, forceVariables, isPaused, isSubFlowWrappedUp, lastActive, pauseExecution, preExecute, resumeExecution, setParent, setUpSubActors, updateParent, wrapUp, wrapUpSubFlow
      • Methods inherited from class adams.flow.core.AbstractActor

        annotationsTipText, backupState, canPerformSetUpCheck, compareTo, configureLogger, equals, finalUpdateVariables, findVariables, findVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, pruneBackup, restoreState, setAnnotations, setErrorHandler, setName, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
      • Methods inherited from interface adams.flow.core.Actor

        cleanUp, compareTo, destroy, equals, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged, wrapUp
      • Methods inherited from interface adams.core.AdditionalInformationHandler

        getAdditionalInformation
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel, setLoggingLevel
      • Methods inherited from interface adams.core.logging.LoggingSupporter

        getLogger, isLoggingEnabled
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager
      • Methods inherited from interface adams.core.VariablesInspectionHandler

        canInspectOptions
    • Field Detail

      • m_RejectedTokensActor

        protected adams.flow.core.Actor m_RejectedTokensActor
        the actor for the rejected tokens.
      • m_RejectionMessagesActor

        protected adams.flow.core.Actor m_RejectionMessagesActor
        the actor for the rejection messages.
      • m_Cleaner

        protected AbstractCleaner m_Cleaner
        the instance cleaner to use.
      • m_InputToken

        protected transient adams.flow.core.Token m_InputToken
        the input token.
      • m_OutputToken

        protected transient adams.flow.core.Token m_OutputToken
        the output token.
      • m_DatabaseConnectionUpdated

        protected boolean m_DatabaseConnectionUpdated
        whether the database connection has been updated.
    • Constructor Detail

      • InstanceCleaner

        public InstanceCleaner()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.flow.core.AbstractActor
      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.flow.control.AbstractControlActor
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class adams.flow.control.AbstractControlActor
      • setRejectedTokensActor

        public void setRejectedTokensActor​(adams.flow.core.Actor value)
        Sets the actor to send the rejected tokens to.
        Parameters:
        value - the actor
      • getRejectedTokensActor

        public adams.flow.core.Actor getRejectedTokensActor()
        Returns the actor the rejected tokens are sent to.
        Returns:
        the actor
      • rejectedTokensActorTipText

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

        public void setRejectionMessagesActor​(adams.flow.core.Actor value)
        Sets the actor to send the rejection messages to.
        Parameters:
        value - the actor
      • getRejectionMessagesActor

        public adams.flow.core.Actor getRejectionMessagesActor()
        Returns the actor to send the rejection messages to.
        Returns:
        the actor
      • rejectionMessagesActorTipText

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

        public void setCleaner​(AbstractCleaner value)
        Sets the cleaner.
        Parameters:
        value - the cleaner
      • getCleaner

        public AbstractCleaner getCleaner()
        Returns the cleaner.
        Returns:
        the actor
      • cleanerTipText

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

        public int size()
        Returns the size of the group.
        Specified by:
        size in interface adams.flow.core.ActorHandler
        Specified by:
        size in class adams.flow.control.AbstractControlActor
        Returns:
        always 2
      • get

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

        public String set​(int index,
                          adams.flow.core.Actor actor)
        Sets the actor at the given position.
        Specified by:
        set in interface adams.flow.core.ActorHandler
        Specified by:
        set in class adams.flow.control.AbstractControlActor
        Parameters:
        index - the position
        actor - the actor to set at this position
        Returns:
        null if everything is fine, otherwise the error
      • indexOf

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

        public adams.flow.core.ActorHandlerInfo getActorHandlerInfo()
        Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.
        Specified by:
        getActorHandlerInfo in interface adams.flow.core.ActorHandler
        Specified by:
        getActorHandlerInfo in class adams.flow.control.AbstractControlActor
        Returns:
        the info
      • accepts

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

        public String setUp()
        Initializes the sub-actors for flow execution.
        Specified by:
        setUp in interface adams.flow.core.Actor
        Overrides:
        setUp in class adams.flow.control.AbstractControlActor
        Returns:
        null if everything is fine, otherwise error message
      • input

        public void input​(adams.flow.core.Token token)
        The method that accepts the input token and then processes it.
        Specified by:
        input in interface adams.flow.core.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 adams.flow.core.InputConsumer
        Returns:
        true if input token present
      • currentInput

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

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

        public String execute()
        Executes the flow item.
        Specified by:
        execute in interface adams.flow.core.Actor
        Overrides:
        execute in class adams.flow.core.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 adams.flow.core.OutputProducer
        Returns:
        weka.core.Instance.class
      • output

        public adams.flow.core.Token output()
        Returns the generated token.
        Specified by:
        output in interface adams.flow.core.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 adams.flow.core.OutputProducer
        Returns:
        true if there is pending output
      • flushExecution

        public void flushExecution()
        Stops the processing of tokens without stopping the flow.
        Specified by:
        flushExecution in interface adams.flow.core.ActorHandler
        Specified by:
        flushExecution in interface adams.flow.core.Flushable
        Overrides:
        flushExecution in class adams.flow.control.AbstractControlActor
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface adams.flow.core.Actor
        Specified by:
        stopExecution in interface adams.core.Stoppable
        Overrides:
        stopExecution in class adams.flow.control.AbstractControlActor