Package adams.flow.sink
Class PlotContainerSink
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,FileWriter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,InputConsumer
,Serializable
,Comparable
public class PlotContainerSink extends AbstractFileWriter
Actor that outputs the plot containers in various formats.
Input/output:
- accepts:
adams.flow.container.SequencePlotterContainer
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: PlotContainerSink
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-output <adams.core.io.PlaceholderFile> (property: outputFile) The file to save the generated output to. default: .
-writer <adams.core.io.AbstractSpreadSheetWriter> (property: writer) The writer to use for outputting the plot containers. default: adams.core.io.CsvSpreadSheetWriter
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PlotContainerSink.DoubleComparator
Comparator for doubles that are stored as string.
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_SPREADSHEET
the key for storing the spreadsheet generated so far in the backup.static String
BACKUP_TOKENCOUNTS
the key for storing the token counts in the backup.static String
COLUMN_X
the key for storing the X value in the spreadsheet.protected PlotContainerSink.DoubleComparator
m_Comparator
the comparator to use.protected SpreadSheet
m_SpreadSheet
stores the content of the plot containers.protected NamedCounter
m_TokenCounts
for keeping track of the number of tokens being added for a specific sequence, in case the X value is undefined (seqname - count relation).protected SpreadSheetWriter
m_Writer
the writer to use.-
Fields inherited from class adams.flow.sink.AbstractFileWriter
m_OutputFile
-
Fields inherited from class adams.flow.sink.AbstractSink
BACKUP_INPUT, m_InputToken
-
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 PlotContainerSink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.SpreadSheetWriter
getWriter()
Returns the writer to use for outputting the plot containers.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
outputFileTipText()
Returns the tip text for this property.protected void
pruneBackup()
Removes entries from the backup.protected void
reset()
Initializes the members.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setWriter(SpreadSheetWriter value)
Sets the writer to use for outputting the plot containers.void
wrapUp()
Cleans up after the execution has finished.String
writerTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.sink.AbstractFileWriter
getDefaultOutputFile, getOutputFile, setOutputFile, setUp
-
Methods inherited from class adams.flow.sink.AbstractSink
currentInput, hasInput, input, postExecute
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, 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, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, 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, stopExecution, toCommandLine, variableChanged
-
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
-
BACKUP_SPREADSHEET
public static final String BACKUP_SPREADSHEET
the key for storing the spreadsheet generated so far in the backup.- See Also:
- Constant Field Values
-
BACKUP_TOKENCOUNTS
public static final String BACKUP_TOKENCOUNTS
the key for storing the token counts in the backup.- See Also:
- Constant Field Values
-
COLUMN_X
public static final String COLUMN_X
the key for storing the X value in the spreadsheet.- See Also:
- Constant Field Values
-
m_Writer
protected SpreadSheetWriter m_Writer
the writer to use.
-
m_SpreadSheet
protected SpreadSheet m_SpreadSheet
stores the content of the plot containers.
-
m_TokenCounts
protected NamedCounter m_TokenCounts
for keeping track of the number of tokens being added for a specific sequence, in case the X value is undefined (seqname - count relation).
-
m_Comparator
protected PlotContainerSink.DoubleComparator m_Comparator
the comparator to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractFileWriter
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractFileWriter
- Returns:
- null if no info available, otherwise short string
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractActor
-
reset
protected void reset()
Initializes the members.- Overrides:
reset
in classAbstractActor
-
outputFileTipText
public String outputFileTipText()
Returns the tip text for this property.- Specified by:
outputFileTipText
in interfaceFileWriter
- Specified by:
outputFileTipText
in classAbstractFileWriter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWriter
public void setWriter(SpreadSheetWriter value)
Sets the writer to use for outputting the plot containers.- Parameters:
value
- the writer
-
getWriter
public SpreadSheetWriter getWriter()
Returns the writer to use for outputting the plot containers.- Returns:
- the writer
-
writerTipText
public String writerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
pruneBackup
protected void pruneBackup()
Removes entries from the backup.- Overrides:
pruneBackup
in classAbstractActor
- See Also:
AbstractActor.reset()
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classAbstractSink
- Returns:
- the backup
- See Also:
AbstractActor.updateVariables()
,AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractSink
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Returns:
- adams.flow.container.SequencePlotterContainer.class
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractSink
-
-