Package adams.flow.control
Class InstanceCleaner
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.control.AbstractControlActor
-
- adams.flow.control.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 NullDefault 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 AbstractCleanerm_Cleanerthe instance cleaner to use.protected booleanm_DatabaseConnectionUpdatedwhether the database connection has been updated.protected adams.flow.core.Tokenm_InputTokenthe input token.protected adams.flow.core.Tokenm_OutputTokenthe output token.protected adams.flow.core.Actorm_RejectedTokensActorthe actor for the rejected tokens.protected adams.flow.core.Actorm_RejectionMessagesActorthe 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
-
-
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.StringcleanerTipText()Returns the tip text for this property.adams.flow.core.TokencurrentInput()Returns the current input token, if any.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the actor.Stringexecute()Executes the flow item.voidflushExecution()Stops the processing of tokens without stopping the flow.Class[]generates()Returns the class of objects that it generates.adams.flow.core.Actorget(int index)Returns the actor at the given position.adams.flow.core.ActorHandlerInfogetActorHandlerInfo()Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.AbstractCleanergetCleaner()Returns the cleaner.adams.flow.core.ActorgetRejectedTokensActor()Returns the actor the rejected tokens are sent to.adams.flow.core.ActorgetRejectionMessagesActor()Returns the actor to send the rejection messages to.StringglobalInfo()Returns a string describing the object.booleanhasInput()Returns whether an input token is currently present.booleanhasPendingOutput()Checks whether there is pending output to be collected after executing the flow item.intindexOf(String actor)Returns the index of the actor.protected voidinitialize()Initializes the members.voidinput(adams.flow.core.Token token)The method that accepts the input token and then processes it.adams.flow.core.Tokenoutput()Returns the generated token.StringrejectedTokensActorTipText()Returns the tip text for this property.StringrejectionMessagesActorTipText()Returns the tip text for this property.protected voidreset()Resets the scheme.Stringset(int index, adams.flow.core.Actor actor)Sets the actor at the given position.voidsetCleaner(AbstractCleaner value)Sets the cleaner.voidsetRejectedTokensActor(adams.flow.core.Actor value)Sets the actor to send the rejected tokens to.voidsetRejectionMessagesActor(adams.flow.core.Actor value)Sets the actor to send the rejection messages to.StringsetUp()Initializes the sub-actors for flow execution.intsize()Returns the size of the group.voidstopExecution()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 class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
-
-
-
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.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:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.flow.core.AbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classadams.flow.control.AbstractControlActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classadams.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:
sizein interfaceadams.flow.core.ActorHandler- Specified by:
sizein classadams.flow.control.AbstractControlActor- Returns:
- always 2
-
get
public adams.flow.core.Actor get(int index)
Returns the actor at the given position.- Specified by:
getin interfaceadams.flow.core.ActorHandler- Specified by:
getin classadams.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:
setin interfaceadams.flow.core.ActorHandler- Specified by:
setin classadams.flow.control.AbstractControlActor- Parameters:
index- the positionactor- 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:
indexOfin interfaceadams.flow.core.ActorHandler- Specified by:
indexOfin classadams.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:
getActorHandlerInfoin interfaceadams.flow.core.ActorHandler- Specified by:
getActorHandlerInfoin classadams.flow.control.AbstractControlActor- Returns:
- the info
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
acceptsin interfaceadams.flow.core.InputConsumer- Returns:
- weka.core.Instance.class
-
setUp
public String setUp()
Initializes the sub-actors for flow execution.- Specified by:
setUpin interfaceadams.flow.core.Actor- Overrides:
setUpin classadams.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:
inputin interfaceadams.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:
hasInputin interfaceadams.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:
currentInputin interfaceadams.flow.core.InputConsumer- Returns:
- the input token, null if none present
-
doExecute
protected String doExecute()
Executes the actor.- Specified by:
doExecutein classadams.flow.core.AbstractActor- Returns:
- null if everything is fine, otherwise error message
-
execute
public String execute()
Executes the flow item.- Specified by:
executein interfaceadams.flow.core.Actor- Overrides:
executein classadams.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:
generatesin interfaceadams.flow.core.OutputProducer- Returns:
- weka.core.Instance.class
-
output
public adams.flow.core.Token output()
Returns the generated token.- Specified by:
outputin interfaceadams.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:
hasPendingOutputin interfaceadams.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:
flushExecutionin interfaceadams.flow.core.ActorHandler- Specified by:
flushExecutionin interfaceadams.flow.core.Flushable- Overrides:
flushExecutionin classadams.flow.control.AbstractControlActor
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceadams.flow.core.Actor- Specified by:
stopExecutionin interfaceadams.core.Stoppable- Overrides:
stopExecutionin classadams.flow.control.AbstractControlActor
-
-