Package adams.gui.visualization.core
Class AbstractColorProvider
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.AbstractColorProvider
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<ColorProvider>,SizeOfHandler,ColorProvider,Serializable
- Direct Known Subclasses:
AbstractCustomColorProvider,DefaultColorProvider,FluoroColorProvider,GradientColorProvider,PeriodicityColorProvider,TranslucentColorProvider,X11ColorProvider
public abstract class AbstractColorProvider extends AbstractOptionHandler implements ColorProvider
A class for providing colors.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_AllowDarkeningwhether darkening of colors is allowed.protected booleanm_CheckTooDarkwhether to ensure that colors aren't too dark.protected List<Color>m_Colorscontains the current colors.protected List<Color>m_DefaultColorscontains the default colors.protected List<Color>m_ExcludedColorsexcluded colors (already used).protected booleanm_FirstIterationwhether it is the first iteration.protected intm_Indexthe current index.protected List<Color>m_RecycledColorsrecycled, i.e., returned colors.static intMIN_VALUEthe minimum value for R, G and B before restarting the color provider.-
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 AbstractColorProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexclude(Color c)"Excludes" the specified colors, i.e., makes it unavailable for future use.protected voidfinishInit()Finishes the initialization.static ColorProviderforCommandLine(String cmdline)Instantiates the provider from the given commandline (i.e., classname and optional options).static ColorProviderforName(String classname, String[] options)Instantiates the provider with the given options.Color[]generate(int numColors)Generates the specified number of colors.protected voidinitialize()Initializes the members.Colornext()Returns the next color.voidrecycle(Color c)"Recycles" the specified colors, i.e., makes it available for future use.voidresetColors()Resets the colors.ColorProvidershallowCopy()Returns a shallow copy of itself.ColorProvidershallowCopy(boolean expand)Returns a shallow copy of itself.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, toCommandLine, toString
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
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.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
MIN_VALUE
public static final int MIN_VALUE
the minimum value for R, G and B before restarting the color provider.- See Also:
- Constant Field Values
-
m_Index
protected int m_Index
the current index.
-
m_FirstIteration
protected boolean m_FirstIteration
whether it is the first iteration.
-
m_AllowDarkening
protected boolean m_AllowDarkening
whether darkening of colors is allowed.
-
m_CheckTooDark
protected boolean m_CheckTooDark
whether to ensure that colors aren't too dark.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInitin classAbstractOptionHandler
-
next
public Color next()
Returns the next color.- Specified by:
nextin interfaceColorProvider- Returns:
- the next color
-
resetColors
public void resetColors()
Resets the colors.- Specified by:
resetColorsin interfaceColorProvider
-
recycle
public void recycle(Color c)
"Recycles" the specified colors, i.e., makes it available for future use.- Specified by:
recyclein interfaceColorProvider- Parameters:
c- the color to re-use
-
exclude
public void exclude(Color c)
"Excludes" the specified colors, i.e., makes it unavailable for future use.- Specified by:
excludein interfaceColorProvider- Parameters:
c- the color to exclude
-
generate
public Color[] generate(int numColors)
Generates the specified number of colors.- Specified by:
generatein interfaceColorProvider- Parameters:
numColors- the number of colors- Returns:
- the colors
-
shallowCopy
public ColorProvider shallowCopy()
Returns a shallow copy of itself.- Specified by:
shallowCopyin interfaceShallowCopySupporter<ColorProvider>- Returns:
- the shallow copy
-
shallowCopy
public ColorProvider shallowCopy(boolean expand)
Returns a shallow copy of itself.- Specified by:
shallowCopyin interfaceShallowCopySupporter<ColorProvider>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
forName
public static ColorProvider forName(String classname, String[] options)
Instantiates the provider with the given options.- Parameters:
classname- the classname of the provider to instantiateoptions- the options for the provider- Returns:
- the instantiated provider or null if an error occurred
-
forCommandLine
public static ColorProvider forCommandLine(String cmdline)
Instantiates the provider from the given commandline (i.e., classname and optional options).- Parameters:
cmdline- the classname (and optional options) of the provider to instantiate- Returns:
- the instantiated provider or null if an error occurred
-
-