Package adams.flow.processor
Class AbstractListingProcessor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.processor.AbstractActorProcessor
-
- adams.flow.processor.AbstractListingProcessor
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<ActorProcessor>
,SizeOfHandler
,ActorProcessor
,GraphicalOutputProducingProcessor
,ListingProcessor
,Serializable
,Comparable<ActorProcessor>
- Direct Known Subclasses:
AbstractActorListingProcessor
,ListAnnotationTags
,ListDatabaseConnections
,ListObjectCommandlines
,ListPaths
,ListStructureModifyingActors
,ListTODOs
public abstract class AbstractListingProcessor extends AbstractActorProcessor implements GraphicalOutputProducingProcessor, ListingProcessor
Ancestor for processors that list stuff.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
m_List
for storing the list items.-
Fields inherited from class adams.flow.processor.AbstractActorProcessor
m_Errors
-
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 AbstractListingProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
finalizeList()
Finishes up the list, e.g., sorts it.protected boolean
generatesMultipleItems()
Returns whether the list generates a string array per object or not.protected Dimension
getDefaultSize()
Returns the default sie of the dialog.Component
getGraphicalOutput()
Returns the graphical output that was generated.protected abstract String
getHeader()
Returns the header to use in the dialog, i.e., the one-liner that explains the output.List<String>
getList()
Returns the list.boolean
hasGraphicalOutput()
Returns whether graphical output was generated.protected void
initializeList()
Initializes the list.protected abstract boolean
isSortedList()
Returns whether the list should be sorted.protected abstract boolean
isUniqueList()
Returns whether the list should not contain any duplicates.protected abstract boolean
isValid(AbstractOption option, Object obj, OptionTraversalPath path)
Checks whether the object is valid and should be added to the list.protected String
objectToString(AbstractOption option, Object obj, OptionTraversalPath path)
Returns the string representation of the object that is to be added to the list.protected String[]
objectToStrings(AbstractOption option, Object obj, OptionTraversalPath path)
Returns the string array representation of the object that is to be added to the list.protected void
process(AbstractOption option, Object obj, OptionTraversalPath path)
Processes the object.protected void
processActor(Actor actor)
Performs the actual processing.-
Methods inherited from class adams.flow.processor.AbstractActorProcessor
addError, addError, checkData, compareTo, equals, getErrors, hasErrors, initialize, process, reset, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.processor.ActorProcessor
compareTo, getErrors, hasErrors, process, shallowCopy, shallowCopy
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.flow.processor.GraphicalOutputProducingProcessor
getTitle
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
isValid
protected abstract boolean isValid(AbstractOption option, Object obj, OptionTraversalPath path)
Checks whether the object is valid and should be added to the list.- Parameters:
option
- the current optionobj
- the object to checkpath
- the traversal path of properties- Returns:
- true if valid
-
objectToString
protected String objectToString(AbstractOption option, Object obj, OptionTraversalPath path)
Returns the string representation of the object that is to be added to the list.
Default implementation only calls thetoString()
method.- Parameters:
option
- the current optionobj
- the object to turn into a stringpath
- the traversal path of properties- Returns:
- the string representation, null if to ignore the item
-
objectToStrings
protected String[] objectToStrings(AbstractOption option, Object obj, OptionTraversalPath path)
Returns the string array representation of the object that is to be added to the list.
Default implementation only calls thetoString()
method.- Parameters:
option
- the current optionobj
- the object to turn into a stringpath
- the traversal path of properties- Returns:
- the string representation, null if to ignore the item
-
process
protected void process(AbstractOption option, Object obj, OptionTraversalPath path)
Processes the object.- Parameters:
option
- the current optionobj
- the objectpath
- the traversal path of properties
-
generatesMultipleItems
protected boolean generatesMultipleItems()
Returns whether the list generates a string array per object or not.- Returns:
- true if multiple items get generated
- See Also:
objectToString(AbstractOption, Object, OptionTraversalPath)
,objectToStrings(AbstractOption, Object, OptionTraversalPath)
-
isSortedList
protected abstract boolean isSortedList()
Returns whether the list should be sorted.- Returns:
- true if the list should get sorted
-
isUniqueList
protected abstract boolean isUniqueList()
Returns whether the list should not contain any duplicates.- Returns:
- true if the list contains no duplicates
-
initializeList
protected void initializeList()
Initializes the list.
Default implementation creates an empty vector.
-
processActor
protected void processActor(Actor actor)
Performs the actual processing.- Specified by:
processActor
in classAbstractActorProcessor
- Parameters:
actor
- the actor to process (is a copy of original for processors implementing ModifyingProcessor)- See Also:
ModifyingProcessor
-
finalizeList
protected void finalizeList()
Finishes up the list, e.g., sorts it.- See Also:
isSortedList()
-
hasGraphicalOutput
public boolean hasGraphicalOutput()
Returns whether graphical output was generated.- Specified by:
hasGraphicalOutput
in interfaceGraphicalOutputProducingProcessor
- Returns:
- true if graphical output was generated
-
getHeader
protected abstract String getHeader()
Returns the header to use in the dialog, i.e., the one-liner that explains the output.- Returns:
- the header, null if no header available
-
getDefaultSize
protected Dimension getDefaultSize()
Returns the default sie of the dialog.
The default is 400x300.- Returns:
- the size
-
getGraphicalOutput
public Component getGraphicalOutput()
Returns the graphical output that was generated.- Specified by:
getGraphicalOutput
in interfaceGraphicalOutputProducingProcessor
- Returns:
- the graphical output
-
getList
public List<String> getList()
Returns the list.- Specified by:
getList
in interfaceListingProcessor
- Returns:
- the list
-
-