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_Blacklistedblacklisted classes.protected ArrayList<String>m_OutputListthe 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 voidcleanUp()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.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the visitor.protected String[]initOutput()Initializes the output data structure.static voidmain(String[] args)Executes the producer from commandline.protected voidpreProduce()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.voidsetBlacklisted(Class[] value)Sets the classes to avoid.StringtoString()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:
globalInfoin interfaceOptionProducer<String[],ArrayList<String>>- Specified by:
globalInfoin classAbstractOptionProducer<String[],ArrayList<String>>- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the visitor.- Overrides:
initializein classAbstractOptionProducer<String[],ArrayList<String>>
-
setBlacklisted
public void setBlacklisted(Class[] value)
Sets the classes to avoid.- Specified by:
setBlacklistedin interfaceBlacklistedOptionProducer- Parameters:
value- the classes
-
getBlacklisted
public Class[] getBlacklisted()
Returns the blacklisted classes.- Specified by:
getBlacklistedin interfaceBlacklistedOptionProducer- Returns:
- the classes
-
initOutput
protected String[] initOutput()
Initializes the output data structure.- Specified by:
initOutputin classAbstractOptionProducer<String[],ArrayList<String>>- Returns:
- the created data structure
-
processOption
public ArrayList<String> processOption(BooleanOption option)
Visits a boolean option.- Specified by:
processOptionin interfaceOptionProducer<String[],ArrayList<String>>- Specified by:
processOptionin 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:
processOptionin interfaceOptionProducer<String[],ArrayList<String>>- Specified by:
processOptionin 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:
processOptionin interfaceOptionProducer<String[],ArrayList<String>>- Specified by:
processOptionin 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:
preProducein 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:
doProducein interfaceOptionProducer<String[],ArrayList<String>>- Overrides:
doProducein 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:
getOutputin interfaceOptionProducer<String[],ArrayList<String>>- Overrides:
getOutputin classAbstractOptionProducer<String[],ArrayList<String>>- Returns:
- the output
- See Also:
AbstractOptionProducer.initOutput()
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toStringin interfaceOptionProducer<String[],ArrayList<String>>- Specified by:
toStringin 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:
cleanUpin interfaceCleanUpHandler- Specified by:
cleanUpin interfaceOptionProducer<String[],ArrayList<String>>- Overrides:
cleanUpin 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
-
-