Package adams.db
Class AbstractConditions
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.db.AbstractConditions
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,PreGetOptionslistHook
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractLimitedConditions
public abstract class AbstractConditions extends AbstractOptionHandler implements PreGetOptionslistHook
Abstract ancestor for classes that encapsulate conditions for database retrieval.- Version:
- $Revision$
- 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 AbstractConditions()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
check()
Checks the correctness of the provided values, may throw unchecked Exceptions.int
compareTo(Object o)
Compares this object with the specified object for order.boolean
equals(Object o)
Returns whether the two objects are the same.static AbstractConditions
forCommandLine(String cmdline)
Instantiates the conditions from the given commandline (i.e., classname and optional options).static AbstractConditions
forName(String classname, String[] options)
Instantiates the conditions with the given options.static String[]
getFilters()
Returns a list with classnames of conditions.void
preGetOptionsList()
Gets executed before list of options can get obtained.AbstractConditions
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractConditions
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.abstract void
update()
Automatically corrects values, but does not throw any exceptions.-
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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
preGetOptionsList
public void preGetOptionsList()
Gets executed before list of options can get obtained.- Specified by:
preGetOptionsList
in interfacePreGetOptionslistHook
-
update
public abstract void update()
Automatically corrects values, but does not throw any exceptions. Derived classes must override this method.
-
check
public void check()
Checks the correctness of the provided values, may throw unchecked Exceptions.
Default implementation merely calls "update()" to ensure corrected values. Derived classes can add checks/throw exceptions.
-
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.- 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.
-
shallowCopy
public AbstractConditions shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Returns:
- the shallow copy
-
shallowCopy
public AbstractConditions shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
getFilters
public static String[] getFilters()
Returns a list with classnames of conditions.- Returns:
- the conditions classnames
-
forName
public static AbstractConditions forName(String classname, String[] options)
Instantiates the conditions with the given options.- Parameters:
classname
- the classname of the conditions to instantiateoptions
- the options for the conditions- Returns:
- the instantiated conditions or null if an error occurred
-
forCommandLine
public static AbstractConditions forCommandLine(String cmdline)
Instantiates the conditions from the given commandline (i.e., classname and optional options).- Parameters:
cmdline
- the classname (and optional options) of the conditions to instantiate- Returns:
- the instantiated conditions or null if an error occurred
-
-