de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization
Interface Parameterization

All Known Implementing Classes:
AbstractParameterization, ChainedParameterization, EmptyParameterization, ListParameterization, MergedParameterization, SerializedParameterization, TrackParameters, UnParameterization

public interface Parameterization

Interface for object parameterizations. See the de.lmu.ifi.dbs.elki.utilities.optionhandling package for documentation!


Method Summary
 boolean checkConstraint(GlobalParameterConstraint constraint)
          Check a parameter constraint.
 Parameterization descend(Object option)
          Descend parameterization tree into sub-option.
 Collection<ParameterException> getErrors()
          Get the configuration errors thrown in grab(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter)
 boolean grab(Parameter<?,?> opt)
          Get the option value from the Parameterization.
 boolean hasErrors()
          Return true when there have been errors.
 boolean hasUnusedParameters()
          Check for unused parameters
 void 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.
<C> C
tryInstantiate(Class<C> c)
          Try to instantiate a particular class.
<C> C
tryInstantiate(Class<C> r, Class<?> c)
          Try to instantiate a particular class.
 

Method Detail

grab

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(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter) can return true when Flag.getValue() returns false! Instead the semantics of grab are those of Parameter#isDefined(). This method will catch ParameterExceptions and store them to be retrieved by getErrors().

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

Collection<ParameterException> getErrors()
Get the configuration errors thrown in grab(de.lmu.ifi.dbs.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

checkConstraint

boolean checkConstraint(GlobalParameterConstraint constraint)
Check a parameter constraint.

Parameters:
constraint - Parameter constraint
Returns:
test result

descend

Parameterization descend(Object option)
Descend parameterization tree into sub-option. Note: this is done automatically by a ClassParameter.instantiateClass(de.lmu.ifi.dbs.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

boolean hasErrors()
Return true when there have been errors.

Returns:
Success code

tryInstantiate

<C> C tryInstantiate(Class<C> r,
                     Class<?> c)
Try to instantiate a particular class.

Type Parameters:
C - return type
Parameters:
r - Restriction class
c - Base class
Returns:
class instance or null

tryInstantiate

<C> C tryInstantiate(Class<C> c)
Try to instantiate a particular class.

Type Parameters:
C - return type
Parameters:
c - Base class
Returns:
class instance or null

Release 0.4.0 (2011-09-20_1324)