Package adams.core.option
Class NestedProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducer<List,List>
-
- adams.core.option.NestedProducer
-
- All Implemented Interfaces:
CleanUpHandler
,EncodingSupporter
,LoggingSupporter
,BlacklistedOptionProducer
,OptionProducer<List,List>
,RecursiveOptionProducer
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
DebugNestedProducer
public class NestedProducer extends AbstractRecursiveOptionProducer<List,List> implements BlacklistedOptionProducer, EncodingSupporter
Generates the nested format.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static char[]
BACKQUOTE_CHARS
the characters to backquote.static String[]
BACKQUOTE_STRINGS
the backquoted stringsf.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 Class[]
m_Blacklisted
blacklisted classes.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.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 NestedProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List
doProduce(AbstractOption option)
Visits the option and obtains information from it.String
encodingTipText()
Returns the tip text for this property.Class[]
getBlacklisted()
Returns the blacklisted classes.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()
Used for initializing 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
postProduce()
Hook-method after visiting options.protected void
preProduce()
Hook-method before starting visiting options.List
processOption(AbstractArgumentOption option)
Visits an argument option.List
processOption(BooleanOption option)
Visits a boolean option.List
processOption(ClassOption option)
Visits a class option.void
setBlacklisted(Class[] value)
Sets the classes to avoid.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.String
toString()
Returns the output generated from the visit.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
checkInput, doProduce, getCurrentValue, getInput, getOptionIdentifier, getOutput, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, preProduce, produce, 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
-
BACKQUOTE_CHARS
public static final char[] BACKQUOTE_CHARS
the characters to backquote.
-
BACKQUOTE_STRINGS
public static final String[] BACKQUOTE_STRINGS
the backquoted stringsf.
-
m_Blacklisted
protected Class[] m_Blacklisted
blacklisted classes.
-
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.
-
-
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()
Used for initializing members.- Overrides:
initialize
in classAbstractOptionProducer<List,List>
-
getDateFormat
protected DateFormat getDateFormat()
Returns the formatter for the timestamps.- Returns:
- the formatter
-
setBlacklisted
public void setBlacklisted(Class[] value)
Sets the classes to avoid.- Specified by:
setBlacklisted
in interfaceBlacklistedOptionProducer
- Parameters:
value
- the classes
-
getBlacklisted
public Class[] getBlacklisted()
Returns the blacklisted classes.- Specified by:
getBlacklisted
in interfaceBlacklistedOptionProducer
- Returns:
- the classes
-
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)
Visits a boolean option.- Specified by:
processOption
in interfaceOptionProducer<List,List>
- Specified by:
processOption
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the boolean option- Returns:
- the last internal data structure that was generated
-
processOption
public List processOption(ClassOption option)
Visits a class option.- Specified by:
processOption
in interfaceOptionProducer<List,List>
- Specified by:
processOption
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the class option- Returns:
- the last internal data structure that was generated
-
processOption
public List processOption(AbstractArgumentOption option)
Visits an argument option.- Specified by:
processOption
in interfaceOptionProducer<List,List>
- Specified by:
processOption
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the argument option- Returns:
- the last internal data structure that was generated
-
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.- Returns:
- the output, null in case of an error
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProduce
in classAbstractOptionProducer<List,List>
- See Also:
AbstractOptionProducer.initOutput()
-
doProduce
public List doProduce(AbstractOption option)
Visits the option and obtains information from it.- Specified by:
doProduce
in interfaceOptionProducer<List,List>
- Overrides:
doProduce
in classAbstractOptionProducer<List,List>
- Parameters:
option
- the current option- Returns:
- the last internal data structure that was generated
-
postProduce
protected void postProduce()
Hook-method after visiting options.- Overrides:
postProduce
in classAbstractOptionProducer<List,List>
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args
- the commandline arguments, use -help for help
-
-