Package adams.gui.visualization.core
Class AbstractColorGradientGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.AbstractColorGradientGenerator
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ColorGradientGenerator
,Serializable
,Comparable
- Direct Known Subclasses:
BiColorGenerator
,ColorProviderBasedColorGradientGenerator
,MultiColorGenerator
public abstract class AbstractColorGradientGenerator extends AbstractOptionHandler implements ColorGradientGenerator
Ancestor for classes that generate color gradients.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractColorGradientGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
check()
Hook method for performing checks on the setup.int
compareTo(Object o)
Compares this object with the specified object for order.protected abstract Color[]
doGenerate()
Performs the actual generation.boolean
equals(Object o)
Returns whether the two objects are the same.static ColorGradientGenerator
forCommandLine(String cmdline)
Instantiates the generator from the given commandline (i.e., classname and optional options).static ColorGradientGenerator
forName(String classname, String[] options)
Instantiates the generator with the given options.Color[]
generate()
Generates the color gradients.static String[]
getGenerators()
Returns a list with classnames of generators.ColorGradientGenerator
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.ColorGradientGenerator
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
check
protected void check()
Hook method for performing checks on the setup.
Default implementation does nothing.
-
doGenerate
protected abstract Color[] doGenerate()
Performs the actual generation.- Returns:
- the generated colors
-
generate
public Color[] generate()
Generates the color gradients.- Specified by:
generate
in interfaceColorGradientGenerator
- Returns:
- the colors
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Only compares the commandlines of the two objects.- Specified by:
compareTo
in interfaceColorGradientGenerator
- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object o)
Returns whether the two objects are the same.
Only compares the commandlines of the two objects.- Specified by:
equals
in interfaceColorGradientGenerator
- Overrides:
equals
in classObject
- Parameters:
o
- the object to be compared- Returns:
- true if the object is the same as this one
-
shallowCopy
public ColorGradientGenerator shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceColorGradientGenerator
- Returns:
- the shallow copy
-
shallowCopy
public ColorGradientGenerator shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceColorGradientGenerator
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
getGenerators
public static String[] getGenerators()
Returns a list with classnames of generators.- Returns:
- the generator classnames
-
forName
public static ColorGradientGenerator forName(String classname, String[] options)
Instantiates the generator with the given options.- Parameters:
classname
- the classname of the generator to instantiateoptions
- the options for the generator- Returns:
- the instantiated generator or null if an error occurred
-
forCommandLine
public static ColorGradientGenerator forCommandLine(String cmdline)
Instantiates the generator from the given commandline (i.e., classname and optional options).- Parameters:
cmdline
- the classname (and optional options) of the generator to instantiate- Returns:
- the instantiated generator or null if an error occurred
-
-