Package adams.flow.control.plotprocessor
Class AbstractPlotProcessor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.control.plotprocessor.AbstractPlotProcessor
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,ErrorProvider
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractPlotProcessorWithBuffer
,PassThrough
public abstract class AbstractPlotProcessor extends AbstractOptionHandler implements QuickInfoSupporter, CleanUpHandler, ErrorProvider
Ancestor for processors of plot containers. A processor produces "additional" containers using the input provided by thePlotProcessor
actor. This allows, for instance, for applying smoothing algorithms to the stream of plot containers passing through.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_LastError
for storing an error message.protected String
m_PlotNameSuffix
the suffix for the plotname to use (becomes overlay if none provided).-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractPlotProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
check(SequencePlotterContainer cont)
Checks the current container.void
cleanUp()
Cleans up data structures, frees up memory.void
defineOptions()
Adds options to the internal list of options.protected abstract List<SequencePlotterContainer>
doProcess(SequencePlotterContainer cont)
Processes the provided container.String
getLastError()
Returns the error message from the last processing (if any).protected String
getPlotName(SequencePlotterContainer cont)
Returns the plot name.String
getPlotNameSuffix()
Returns the current suffix for the plot name.protected SequencePlotterContainer.ContentType
getPlotType()
Returns the type of plot to use.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.boolean
hasLastError()
Returns whether the last processing generated an error message.protected void
initialize()
Initializes the members.protected boolean
isValid(Comparable value)
Checks wheteher value is valid.String
plotNameSuffixTipText()
Returns the tip text for this property.protected List<SequencePlotterContainer>
postProcess(List<SequencePlotterContainer> conts)
Post-processes the provided containers.protected void
preProcess(SequencePlotterContainer cont)
Hook method before processing the plot container.List<SequencePlotterContainer>
process(SequencePlotterContainer cont)
Process the given container.protected void
reset()
Resets the scheme.void
setPlotNameSuffix(String value)
Sets the suffix for the plot name.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
setPlotNameSuffix
public void setPlotNameSuffix(String value)
Sets the suffix for the plot name. If left empty, plot container will become aSequencePlotterContainer.ContentType.OVERLAY
.- Parameters:
value
- the suffix
-
getPlotNameSuffix
public String getPlotNameSuffix()
Returns the current suffix for the plot name. If left empty, plot container will become aSequencePlotterContainer.ContentType.OVERLAY
.- Returns:
- the suffix
-
plotNameSuffixTipText
public String plotNameSuffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
check
protected String check(SequencePlotterContainer cont)
Checks the current container.
Default implementation only checks whether a container was provided at all.- Parameters:
cont
- the container to check- Returns:
- null if everything OK, otherwise error message
-
getPlotName
protected String getPlotName(SequencePlotterContainer cont)
Returns the plot name. Takes a potentially set suffix into account.- Parameters:
cont
- the container to extract the name from- Returns:
- the plot name
-
getPlotType
protected SequencePlotterContainer.ContentType getPlotType()
Returns the type of plot to use. In case a plot name suffix is set, it will be normalSequencePlotterContainer.ContentType.PLOT
, otherwiseSequencePlotterContainer.ContentType.OVERLAY
.- Returns:
- the type
-
preProcess
protected void preProcess(SequencePlotterContainer cont)
Hook method before processing the plot container.- Parameters:
cont
- the container to process
-
doProcess
protected abstract List<SequencePlotterContainer> doProcess(SequencePlotterContainer cont)
Processes the provided container. Generates new containers if applicable.- Parameters:
cont
- the container to process- Returns:
- null if no new containers were produced
-
isValid
protected boolean isValid(Comparable value)
Checks wheteher value is valid. Default implementation makes sure that doubles aren't NaN.- Parameters:
value
- the value to check- Returns:
- true if valid
-
postProcess
protected List<SequencePlotterContainer> postProcess(List<SequencePlotterContainer> conts)
Post-processes the provided containers. Default implementation drops containers that have invalid values for X or Y.- Parameters:
conts
- the containers to post-process- Returns:
- null if no new containers were produced
- See Also:
isValid(Comparable)
-
process
public List<SequencePlotterContainer> process(SequencePlotterContainer cont)
Process the given container.- Parameters:
cont
- the container to process- Returns:
- null if no new containers were produced
-
hasLastError
public boolean hasLastError()
Returns whether the last processing generated an error message.- Specified by:
hasLastError
in interfaceErrorProvider
- Returns:
- true if an error message was generated
-
getLastError
public String getLastError()
Returns the error message from the last processing (if any).- Specified by:
getLastError
in interfaceErrorProvider
- Returns:
- the last error message, null if none occurred
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-