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 StringCHARSETthe information on the character set used.static StringCLASS_PATHthe information on the class path.static StringCOMMENTthe line comment character in files storing nested option handlers.static StringDATEthe information on the date.protected static DateFormatm_DateFormatfor formatting dates.protected BaseCharsetm_Encodingthe encoding to use.protected booleanm_OutputClasspathwhether to print the classpath.protected booleanm_OutputLineNumberswhether to print line numbers.protected booleanm_OutputPrologwhether to suppress the prolog.protected NestedConsumerm_StripConsumerfor stripping down an actor.protected NestedProducerm_StripProducerfor stripping down an actor.static StringMODULESthe information on the modules used.static StringPROJECTthe information about the project.static StringUSERthe 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 OptionHandlercheckInput(OptionHandler object)Hook method for performing checks on the input.StringencodingTipText()Returns the tip text for this property.protected DateFormatgetDateFormat()Returns the formatter for the timestamps.BaseCharsetgetEncoding()Returns the encoding to use.booleangetOutputClasspath()Returns whether the classpath (comments) is generated.booleangetOutputLineNumbers()Returns whether line numbers get output.booleangetOutputProlog()Returns whether the prolog (comments) is generated.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected ListinitOutput()Initializes the output data structure.static voidmain(String[] args)Executes the producer from commandline.StringoutputClasspathTipText()Returns the tip text for this property.StringoutputLineNumbersTipText()Returns the tip text for this property.StringoutputPrologTipText()Returns the tip text for this property.protected voidprocess(Actor actor)Processes the actor.ListprocessOption(AbstractArgumentOption option)Not used.ListprocessOption(BooleanOption option)Not used.ListprocessOption(ClassOption option)Not used.Listproduce(OptionHandler visitedObject)Visits the option and obtains information from it.voidsetEncoding(BaseCharset value)Sets the encoding to use.voidsetOutputClasspath(boolean value)Sets whether to output the classpath (in comments) or not.voidsetOutputLineNumbers(boolean value)Sets whether to output the line numbers.voidsetOutputProlog(boolean value)Sets whether to output the prolog (in comments) or not.Actorstrip(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.StringtoString()Returns the output generated from the visit.protected inttoString(StringBuilder buffer, List current, int depth, int lineNo)For generating a string from the nested structure.StringtoString(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:
globalInfoin interfaceOptionProducer<List,List>- Specified by:
globalInfoin classAbstractOptionProducer<List,List>- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein 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:
setEncodingin 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:
getEncodingin 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:
encodingTipTextin 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:
initOutputin classAbstractOptionProducer<List,List>- Returns:
- the created data structure
-
processOption
public List processOption(BooleanOption option)
Not used.- Specified by:
processOptionin interfaceOptionProducer<List,List>- Specified by:
processOptionin classAbstractOptionProducer<List,List>- Parameters:
option- the option- Returns:
- null
-
processOption
public List processOption(ClassOption option)
Not used.- Specified by:
processOptionin interfaceOptionProducer<List,List>- Specified by:
processOptionin classAbstractOptionProducer<List,List>- Parameters:
option- the option- Returns:
- null
-
processOption
public List processOption(AbstractArgumentOption option)
Not used.- Specified by:
processOptionin interfaceOptionProducer<List,List>- Specified by:
processOptionin 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:
checkInputin 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:
producein interfaceOptionProducer<List,List>- Overrides:
producein 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:
toStringin interfaceOptionProducer<List,List>- Specified by:
toStringin 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
-
-