Package adams.core.option
Class NestedConsumer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionConsumer<C,V>
-
- adams.core.option.AbstractRecursiveOptionConsumer<List,List>
-
- adams.core.option.NestedConsumer
-
- All Implemented Interfaces:
CleanUpHandler,EncodingSupporter,LoggingSupporter,OptionConsumer<List,List>,RecursiveOptionConsumer,SizeOfHandler,Serializable
public class NestedConsumer extends AbstractRecursiveOptionConsumer<List,List> implements EncodingSupporter
Parses a nested ArrayList of options.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseCharsetm_Encodingthe encoding to use.-
Fields inherited from class adams.core.option.AbstractRecursiveOptionConsumer
m_Nesting
-
Fields inherited from class adams.core.option.AbstractOptionConsumer
m_ClassnameCache, m_Errors, m_Input, m_Output, m_SkippedProperties, m_UsePropertyNames, m_Warnings
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description NestedConsumer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ArrayListcollectValues(AbstractOption option, List input)Collects all the arguments for given argument options.protected ListconvertToInput(String s)Converts the input string into the internal format.protected voiddoConsume(OptionManager manager, List input)Visits the options.protected voiddoProcessOption(AbstractArgumentOption option, List values)Processes the specified argument option.StringencodingTipText()Returns the tip text for this property.BaseCharsetgetEncoding()Returns the encoding to use.protected StringgetLineRange(List values)Generates a line number range from the list of values (mixed Line/ArrayList).protected voidgetLineRange(List values, gnu.trove.list.array.TIntArrayList range)Collects all the line numbers.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected OptionHandlerinitOutput()Creates the empty option handler from the internal data structure and returns it.protected voidprocessOption(AbstractArgumentOption option, List values)Processes the specified argument option.protected voidprocessOption(BooleanOption option, List values)Processes the specified boolean option.protected voidprocessOption(ClassOption option, List values)Processes the specified class option.voidsetEncoding(BaseCharset value)Sets the encoding to use.-
Methods inherited from class adams.core.option.AbstractRecursiveOptionConsumer
cleanUp, generateLoggingString, getDebugIndentation, getDebugIndentation, getRecursionLevel, reset
-
Methods inherited from class adams.core.option.AbstractOptionConsumer
checkDeprecation, checkDeprecation, consume, consume, consume, determineCharset, forName, fromFile, fromFile, fromString, fromString, fromString, getErrors, getInput, getOptionIdentifier, getOutput, getSkippedProperties, getUsePropertyNames, getWarnings, getWriteMethod, hasErrors, hasWarnings, isQuiet, logError, logWarning, processOption, read, setInput, setLoggingLevel, setQuiet, setSkippedProperties
-
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, toString, wait, wait, wait
-
Methods inherited from interface adams.core.option.OptionConsumer
getLoggingLevel
-
-
-
-
Field Detail
-
m_Encoding
protected BaseCharset m_Encoding
the encoding to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceOptionConsumer<List,List>- Specified by:
globalInfoin classAbstractOptionConsumer<List,List>- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionConsumer<List,List>
-
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.
-
getLineRange
protected void getLineRange(List values, gnu.trove.list.array.TIntArrayList range)
Collects all the line numbers.- Parameters:
values- the list to traverserange- for collecting the line numbers
-
getLineRange
protected String getLineRange(List values)
Generates a line number range from the list of values (mixed Line/ArrayList).- Parameters:
values- the values to inspect- Returns:
- the line range, null if no line numbers available
-
initOutput
protected OptionHandler initOutput()
Creates the empty option handler from the internal data structure and returns it. This option handler will then be "visited".- Specified by:
initOutputin classAbstractOptionConsumer<List,List>- Returns:
- the generated option handler, null in case of an error
-
convertToInput
protected List convertToInput(String s)
Converts the input string into the internal format.- Specified by:
convertToInputin classAbstractOptionConsumer<List,List>- Parameters:
s- the string to process- Returns:
- the internal format, null in case of an error
-
processOption
protected void processOption(BooleanOption option, List values) throws Exception
Processes the specified boolean option.- Specified by:
processOptionin classAbstractOptionConsumer<List,List>- Parameters:
option- the boolean option to processvalues- ignored- Throws:
Exception- if something goes wrong
-
processOption
protected void processOption(ClassOption option, List values) throws Exception
Processes the specified class option.- Specified by:
processOptionin classAbstractOptionConsumer<List,List>- Parameters:
option- the class option to processvalues- the value(s) for the class option- Throws:
Exception- if something goes wrong
-
processOption
protected void processOption(AbstractArgumentOption option, List values) throws Exception
Processes the specified argument option.- Specified by:
processOptionin classAbstractOptionConsumer<List,List>- Parameters:
option- the argument option to processvalues- the value(s) for the argument option- Throws:
Exception- if something goes wrong
-
doProcessOption
protected void doProcessOption(AbstractArgumentOption option, List values) throws Exception
Processes the specified argument option.- Parameters:
option- the argument option to processvalues- the value(s) for the argument option- Throws:
Exception- if something goes wrong
-
collectValues
protected ArrayList collectValues(AbstractOption option, List input)
Collects all the arguments for given argument options.
NB: collection is destructive, i.e., the flags and values are removed from the vector.- Parameters:
option- the option to gather the arguments forinput- the command-line array to process- Returns:
- the collected values
-
doConsume
protected void doConsume(OptionManager manager, List input)
Visits the options.- Specified by:
doConsumein classAbstractOptionConsumer<List,List>- Parameters:
manager- the manager to visitinput- the input data to use
-
-