Package adams.core.option
Class CompactFlowProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducer<List,List>
-
- adams.core.option.CompactFlowProducer
-
- All Implemented Interfaces:
CleanUpHandler
,EncodingSupporter
,LoggingSupporter
,OptionProducer<List,List>
,RecursiveOptionProducer
,SizeOfHandler
,Serializable
public class CompactFlowProducer extends AbstractRecursiveOptionProducer<List,List> implements EncodingSupporter
Generates nested, compact actor flow format.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHARSET
the information on the character set used.static String
CLASS_PATH
the information on the class path.static String
COMMENT
the line comment character in files storing nested option handlers.static String
DATE
the information on the date.protected static DateFormat
m_DateFormat
for formatting dates.protected BaseCharset
m_Encoding
the encoding to use.protected boolean
m_OutputClasspath
whether to print the classpath.protected boolean
m_OutputLineNumbers
whether to print line numbers.protected boolean
m_OutputProlog
whether to suppress the prolog.protected NestedConsumer
m_StripConsumer
for stripping down an actor.protected NestedProducer
m_StripProducer
for stripping down an actor.static String
MODULES
the information on the modules used.static String
PROJECT
the information about the project.static String
USER
the information on the user.-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducer
m_Nesting
-
Fields inherited from class adams.core.option.AbstractOptionProducer
m_Input, m_LastGenerated, m_Output, m_OutputVariableValues, m_SkippedProperties, m_UsePropertyNames
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description CompactFlowProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OptionHandler
checkInput(OptionHandler object)
Hook method for performing checks on the input.String
encodingTipText()
Returns the tip text for this property.protected DateFormat
getDateFormat()
Returns the formatter for the timestamps.BaseCharset
getEncoding()
Returns the encoding to use.boolean
getOutputClasspath()
Returns whether the classpath (comments) is generated.boolean
getOutputLineNumbers()
Returns whether line numbers get output.boolean
getOutputProlog()
Returns whether the prolog (comments) is generated.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.protected List
initOutput()
Initializes the output data structure.static void
main(String[] args)
Executes the producer from commandline.String
outputClasspathTipText()
Returns the tip text for this property.String
outputLineNumbersTipText()
Returns the tip text for this property.String
outputPrologTipText()
Returns the tip text for this property.protected void
process(Actor actor)
Processes the actor.List
processOption(AbstractArgumentOption option)
Not used.List
processOption(BooleanOption option)
Not used.List
processOption(ClassOption option)
Not used.List
produce(OptionHandler visitedObject)
Visits the option and obtains information from it.void
setEncoding(BaseCharset value)
Sets the encoding to use.void
setOutputClasspath(boolean value)
Sets whether to output the classpath (in comments) or not.void
setOutputLineNumbers(boolean value)
Sets whether to output the line numbers.void
setOutputProlog(boolean value)
Sets whether to output the prolog (in comments) or not.Actor
strip(Actor actor)
Returns a stripped down version of the actor, i.e., for ActorHandlers, a copy of the actor without any sub-actors gets returned.String
toString()
Returns the output generated from the visit.protected int
toString(StringBuilder buffer, List current, int depth, int lineNo)
For generating a string from the nested structure.String
toString(List nested)
Returns the output generated from the visit.-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducer
cleanUp, generateLoggingString, getDebugIndentation, getDebugIndentation, getRecursionLevel, reset
-
Methods inherited from class adams.core.option.AbstractOptionProducer
doProduce, doProduce, getCurrentValue, getInput, getOptionIdentifier, getOutput, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, postProduce, preProduce, preProduce, produce, runProducer, setLoggingLevel, setOutputVariableValues, setSkippedProperties, toString, write
-
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.option.OptionProducer
getLoggingLevel
-
-
-
-
Field Detail
-
COMMENT
public static final String COMMENT
the line comment character in files storing nested option handlers.- See Also:
- Constant Field Values
-
PROJECT
public static final String PROJECT
the information about the project.- See Also:
- Constant Field Values
-
DATE
public static final String DATE
the information on the date.- See Also:
- Constant Field Values
-
USER
public static final String USER
the information on the user.- See Also:
- Constant Field Values
-
CHARSET
public static final String CHARSET
the information on the character set used.- See Also:
- Constant Field Values
-
MODULES
public static final String MODULES
the information on the modules used.- See Also:
- Constant Field Values
-
CLASS_PATH
public static final String CLASS_PATH
the information on the class path.- See Also:
- Constant Field Values
-
m_OutputProlog
protected boolean m_OutputProlog
whether to suppress the prolog.
-
m_OutputClasspath
protected boolean m_OutputClasspath
whether to print the classpath.
-
m_OutputLineNumbers
protected boolean m_OutputLineNumbers
whether to print line numbers.
-
m_Encoding
protected BaseCharset m_Encoding
the encoding to use.
-
m_DateFormat
protected static DateFormat m_DateFormat
for formatting dates.
-
m_StripProducer
protected NestedProducer m_StripProducer
for stripping down an actor.
-
m_StripConsumer
protected NestedConsumer m_StripConsumer
for stripping down an actor.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceOptionProducer<List,List>
- Specified by:
globalInfo
in classAbstractOptionProducer<List,List>
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionProducer<List,List>
-
getDateFormat
protected DateFormat getDateFormat()
Returns the formatter for the timestamps.- Returns:
- the formatter
-
setOutputProlog
public void setOutputProlog(boolean value)
Sets whether to output the prolog (in comments) or not.- Parameters:
value
- if true then the prolog is generated
-
getOutputProlog
public boolean getOutputProlog()
Returns whether the prolog (comments) is generated.- Returns:
- true if the prolog is generated
-
outputPrologTipText
public String outputPrologTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputClasspath
public void setOutputClasspath(boolean value)
Sets whether to output the classpath (in comments) or not.- Parameters:
value
- if true then the classpath is generated
-
getOutputClasspath
public boolean getOutputClasspath()
Returns whether the classpath (comments) is generated.- Returns:
- true if the classpath is generated
-
outputClasspathTipText
public String outputClasspathTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputLineNumbers
public void setOutputLineNumbers(boolean value)
Sets whether to output the line numbers.- Parameters:
value
- if true then the lines get prefixed with line numbers
-
getOutputLineNumbers
public boolean getOutputLineNumbers()
Returns whether line numbers get output.- Returns:
- true if lines get prefixed with line numbers
-
outputLineNumbersTipText
public String outputLineNumbersTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setEncoding
public void setEncoding(BaseCharset value)
Sets the encoding to use.- Specified by:
setEncoding
in interfaceEncodingSupporter
- Parameters:
value
- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
getEncoding
public BaseCharset getEncoding()
Returns the encoding to use.- Specified by:
getEncoding
in interfaceEncodingSupporter
- Returns:
- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
encodingTipText
public String encodingTipText()
Returns the tip text for this property.- Specified by:
encodingTipText
in interfaceEncodingSupporter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
initOutput
protected List initOutput()
Initializes the output data structure.- Specified by:
initOutput
in classAbstractOptionProducer<List,List>
- Returns:
- the created data structure
-
processOption
public List processOption(BooleanOption option)
Not used.- Specified by:
processOption
in interfaceOptionProducer<List,List>
- Specified by:
processOption
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the option- Returns:
- null
-
processOption
public List processOption(ClassOption option)
Not used.- Specified by:
processOption
in interfaceOptionProducer<List,List>
- Specified by:
processOption
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the option- Returns:
- null
-
processOption
public List processOption(AbstractArgumentOption option)
Not used.- Specified by:
processOption
in interfaceOptionProducer<List,List>
- Specified by:
processOption
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the option- Returns:
- null
-
strip
public Actor strip(Actor actor)
Returns a stripped down version of the actor, i.e., for ActorHandlers, a copy of the actor without any sub-actors gets returned.- Parameters:
actor
- the actor to strip down- Returns:
- the stripped down actor
- See Also:
ActorHandler
-
checkInput
protected OptionHandler checkInput(OptionHandler object)
Hook method for performing checks on the input. May throw exceptions if object doesn't pass test(s).- Overrides:
checkInput
in classAbstractOptionProducer<List,List>
- Parameters:
object
- the objec to check- Returns:
- the checked object
-
process
protected void process(Actor actor)
Processes the actor.- Parameters:
actor
- the actor to process
-
produce
public List produce(OptionHandler visitedObject)
Visits the option and obtains information from it.- Specified by:
produce
in interfaceOptionProducer<List,List>
- Overrides:
produce
in classAbstractOptionProducer<List,List>
- Parameters:
visitedObject
- the option handler to visit- Returns:
- the generated output
-
toString
protected int toString(StringBuilder buffer, List current, int depth, int lineNo)
For generating a string from the nested structure.- Parameters:
buffer
- the buffer to add tocurrent
- the current list to processdepth
- the nesting depth (used for indentation)lineNo
- the line number (1-based)- Returns:
- the updated line number
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toString
in interfaceOptionProducer<List,List>
- Specified by:
toString
in classAbstractOptionProducer<List,List>
- Returns:
- the output, null in case of an error
-
toString
public String toString(List nested)
Returns the output generated from the visit.- Parameters:
nested
- the nested format- Returns:
- the output, null in case of an error
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args
- the commandline arguments, use -help for help
-
-