Package adams.core.option
Class ArrayProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducer<String[],ArrayList<String>>
-
- adams.core.option.ArrayProducer
-
- All Implemented Interfaces:
CleanUpHandler
,LoggingSupporter
,BlacklistedOptionProducer
,OptionProducer<String[],ArrayList<String>>
,RecursiveOptionProducer
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
MaterializedArrayProducer
public class ArrayProducer extends AbstractRecursiveOptionProducer<String[],ArrayList<String>> implements RecursiveOptionProducer, BlacklistedOptionProducer
Generates the string array format that is used on the command-line.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Class[]
m_Blacklisted
blacklisted classes.protected ArrayList<String>
m_OutputList
the output vector.-
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 ArrayProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.ArrayList<String>
doProduce(AbstractOption option)
Visits the option and obtains information from it.Class[]
getBlacklisted()
Returns the blacklisted classes.static String[]
getOptions(OptionHandler handler)
Returns the string array with all the options of the handler, but without the classname of the handler.String[]
getOutput()
Returns the output generated from the visit.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the visitor.protected String[]
initOutput()
Initializes the output data structure.static void
main(String[] args)
Executes the producer from commandline.protected void
preProduce()
Hook-method before starting visiting options.ArrayList<String>
processOption(AbstractArgumentOption option)
Visits an argument option.ArrayList<String>
processOption(BooleanOption option)
Visits a boolean option.ArrayList<String>
processOption(ClassOption option)
Visits a class option.void
setBlacklisted(Class[] value)
Sets the classes to avoid.String
toString()
Returns the output generated from the visit.-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducer
generateLoggingString, getDebugIndentation, getDebugIndentation, getRecursionLevel, reset
-
Methods inherited from class adams.core.option.AbstractOptionProducer
checkInput, doProduce, getCurrentValue, getInput, getOptionIdentifier, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, 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
-
Methods inherited from interface adams.core.option.RecursiveOptionProducer
getRecursionLevel
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceOptionProducer<String[],ArrayList<String>>
- Specified by:
globalInfo
in classAbstractOptionProducer<String[],ArrayList<String>>
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the visitor.- Overrides:
initialize
in classAbstractOptionProducer<String[],ArrayList<String>>
-
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
-
initOutput
protected String[] initOutput()
Initializes the output data structure.- Specified by:
initOutput
in classAbstractOptionProducer<String[],ArrayList<String>>
- Returns:
- the created data structure
-
processOption
public ArrayList<String> processOption(BooleanOption option)
Visits a boolean option.- Specified by:
processOption
in interfaceOptionProducer<String[],ArrayList<String>>
- Specified by:
processOption
in classAbstractOptionProducer<String[],ArrayList<String>>
- Parameters:
option
- the boolean option- Returns:
- the last internal data structure that was generated
-
processOption
public ArrayList<String> processOption(AbstractArgumentOption option)
Visits an argument option.- Specified by:
processOption
in interfaceOptionProducer<String[],ArrayList<String>>
- Specified by:
processOption
in classAbstractOptionProducer<String[],ArrayList<String>>
- Parameters:
option
- the argument option- Returns:
- the last internal data structure that was generated
-
processOption
public ArrayList<String> processOption(ClassOption option)
Visits a class option.- Specified by:
processOption
in interfaceOptionProducer<String[],ArrayList<String>>
- Specified by:
processOption
in classAbstractOptionProducer<String[],ArrayList<String>>
- Parameters:
option
- the class option- Returns:
- the last internal data structure that was generated
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProduce
in classAbstractOptionProducer<String[],ArrayList<String>>
- See Also:
AbstractOptionProducer.initOutput()
-
doProduce
public ArrayList<String> doProduce(AbstractOption option)
Visits the option and obtains information from it.- Specified by:
doProduce
in interfaceOptionProducer<String[],ArrayList<String>>
- Overrides:
doProduce
in classAbstractOptionProducer<String[],ArrayList<String>>
- Parameters:
option
- the current option- Returns:
- the last internal data structure that was generated
-
getOutput
public String[] getOutput()
Returns the output generated from the visit.- Specified by:
getOutput
in interfaceOptionProducer<String[],ArrayList<String>>
- Overrides:
getOutput
in classAbstractOptionProducer<String[],ArrayList<String>>
- Returns:
- the output
- See Also:
AbstractOptionProducer.initOutput()
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toString
in interfaceOptionProducer<String[],ArrayList<String>>
- Specified by:
toString
in classAbstractOptionProducer<String[],ArrayList<String>>
- Returns:
- the output, null in case of an error
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Specified by:
cleanUp
in interfaceOptionProducer<String[],ArrayList<String>>
- Overrides:
cleanUp
in classAbstractRecursiveOptionProducer<String[],ArrayList<String>>
-
getOptions
public static String[] getOptions(OptionHandler handler)
Returns the string array with all the options of the handler, but without the classname of the handler.- Parameters:
handler
- the handler to return the options for- Returns:
- the options as flat string array
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args
- the commandline arguments, use -help for help
-
-