Class AbstractTickGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.axis.AbstractTickGenerator
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<TickGenerator>,SizeOfHandler,TickGenerator,Serializable
- Direct Known Subclasses:
AbstractLimitedTickGenerator,PeriodicityTickGenerator,SimpleFixedLabelTickGenerator
public abstract class AbstractTickGenerator extends AbstractOptionHandler implements TickGenerator
An abstract class of a tick generator.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected HashSet<String>m_Labelsfor avoiding duplicate labels.protected AbstractAxisModelm_Parentthe owning axis model.protected List<Tick>m_Ticksthe list of ticks to return.-
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 AbstractTickGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddLabel(String label)Adds the label to the internal list of labels generated so far.protected abstract voiddoGenerate()Generate the ticks of this axis.protected StringfixLabel(String label)Fixes the label, i.e., sets it to null if either NaN or already present.static TickGeneratorforCommandLine(String cmdline)Instantiates the generator from the given commandline (i.e., classname and optional options).static TickGeneratorforName(String classname, String[] options)Instantiates the generator with the given options.static String[]getGenerators()Returns a list with classnames of generators.AbstractAxisModelgetParent()Returns the owning axis model.List<Tick>getTicks()Returns the ticks of this axis.protected booleanhasLabel(String label)Checks whether the label is already present.protected voidinitialize()Initializes the member variables.protected voidpostGenerate()Gets executed after generating the ticks.protected voidpreGenerate()Gets executed before generating the ticks.protected voidreset()Resets the generator.voidsetParent(AbstractAxisModel value)Sets the owning axis model.TickGeneratorshallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.TickGeneratorshallowCopy(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, loggingLevelTipText, newOptionManager, 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, 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
-
m_Parent
protected AbstractAxisModel m_Parent
the owning axis model.
-
-
Method Detail
-
reset
protected void reset()
Resets the generator.- Overrides:
resetin classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the member variables.- Overrides:
initializein classAbstractOptionHandler
-
setParent
public void setParent(AbstractAxisModel value)
Sets the owning axis model.- Specified by:
setParentin interfaceTickGenerator- Parameters:
value- the model
-
getParent
public AbstractAxisModel getParent()
Returns the owning axis model.- Specified by:
getParentin interfaceTickGenerator- Returns:
- the model
-
hasLabel
protected boolean hasLabel(String label)
Checks whether the label is already present. If not already present, gets added to the internal list of labels generated so far.- Parameters:
label- the label to check- Returns:
- true if already present, false otherwise (or if null)
-
fixLabel
protected String fixLabel(String label)
Fixes the label, i.e., sets it to null if either NaN or already present.- Parameters:
label- the label to fix- Returns:
- the (potentially) fixed label
-
addLabel
protected void addLabel(String label)
Adds the label to the internal list of labels generated so far.- Parameters:
label- the label to add
-
preGenerate
protected void preGenerate()
Gets executed before generating the ticks.
-
doGenerate
protected abstract void doGenerate()
Generate the ticks of this axis.
-
postGenerate
protected void postGenerate()
Gets executed after generating the ticks.
-
getTicks
public List<Tick> getTicks()
Returns the ticks of this axis.- Specified by:
getTicksin interfaceTickGenerator- Returns:
- the current ticks to display
-
shallowCopy
public TickGenerator shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<TickGenerator>- Returns:
- the shallow copy
-
shallowCopy
public TickGenerator shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<TickGenerator>- 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 TickGenerator 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 TickGenerator 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
-
-