Interface Parameterization
-
- All Known Implementing Classes:
AbstractParameterization
,ChainedParameterization
,EmptyParameterization
,ListParameterization
,MergedParameterization
,SerializedParameterization
,TrackParameters
,UnParameterization
public interface Parameterization
Interface for object parameterizations.See the
elki.utilities.optionhandling
package for documentation!- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Parameterization
descend(java.lang.Object option)
Descend parameterization tree into sub-option.java.util.Collection<ParameterException>
getErrors()
Get the configuration errors thrown ingrab(elki.utilities.optionhandling.parameters.Parameter<?>)
default boolean
grab(Parameter<?> opt)
Get the option value from the Parameterization.default boolean
hasErrors()
Return true when there have been errors.boolean
hasUnusedParameters()
Check for unused parametersvoid
reportError(ParameterException e)
Report a configuration error.boolean
setValueForOption(Parameter<?> opt)
Assign a value for an option, but not using default values and throwing exceptions on error.default <C> C
tryInstantiate(java.lang.Class<C> c)
Try to instantiate a particular class.
-
-
-
Method Detail
-
grab
default boolean grab(Parameter<?> opt)
Get the option value from the Parameterization.Note: this method returns success; the actual value can be obtained from
opt
itself!In particular
grab(elki.utilities.optionhandling.parameters.Parameter<?>)
can returntrue
whenFlag.getValue()
returnsfalse
! Instead the semantics ofgrab
are those ofParameter#isDefined()
.This method will catch
ParameterException
s and store them to be retrieved bygetErrors()
.- Parameters:
opt
- Option to add- Returns:
- if the value is available (= readable)
-
setValueForOption
boolean setValueForOption(Parameter<?> opt) throws ParameterException
Assign a value for an option, but not using default values and throwing exceptions on error.- Parameters:
opt
- Parameter to set- Returns:
- Success code
- Throws:
ParameterException
- on assignment errors.
-
getErrors
java.util.Collection<ParameterException> getErrors()
Get the configuration errors thrown ingrab(elki.utilities.optionhandling.parameters.Parameter<?>)
- Returns:
- Configuration errors encountered
-
reportError
void reportError(ParameterException e)
Report a configuration error.- Parameters:
e
- Destination to report errors to
-
hasUnusedParameters
boolean hasUnusedParameters()
Check for unused parameters- Returns:
true
if at least one parameter was not consumed
-
descend
default Parameterization descend(java.lang.Object option)
Descend parameterization tree into sub-option.Note: this is done automatically by a
ClassParameter.instantiateClass(elki.utilities.optionhandling.parameterization.Parameterization)
. You only need to call this when you want to expose the tree structure without offering a class choice as parameter.- Parameters:
option
- Option subtree- Returns:
- Parameterization
-
hasErrors
default boolean hasErrors()
Return true when there have been errors.- Returns:
- Success code
-
tryInstantiate
default <C> C tryInstantiate(java.lang.Class<C> c)
Try to instantiate a particular class.- Type Parameters:
C
- return type- Parameters:
c
- Base class- Returns:
- class instance or null
-
-