de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization
Class ChainedParameterization

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.AbstractParameterization
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ChainedParameterization
All Implemented Interfaces:
Parameterization

public class ChainedParameterization
extends AbstractParameterization

Class that allows chaining multiple parameterizations. This is designed to allow overriding of some parameters for an algorithm, while other can be configured via different means, e.g. given by the user on the command line. See de.lmu.ifi.dbs.elki.utilities.optionhandling package documentation for examples.


Field Summary
private  Vector<Parameterization> chain
          Keep the list of parameterizations.
private  Parameterization errorTarget
          Error target
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.AbstractParameterization
errors
 
Constructor Summary
ChainedParameterization(Parameterization... ps)
          Constructor that takes a number of Parameterizations to chain.
 
Method Summary
 void appendParameterization(Parameterization p)
          Append a new Parameterization to the chain.
 Parameterization descend(Object option)
          Descend parameterization tree into sub-option.
 void errorsTo(Parameterization config)
          Set the error target, since there is no unique way where errors can be reported.
 boolean hasUnusedParameters()
          Check for unused parameters
 void reportError(ParameterException e)
          Report a configuration error.
 boolean setValueForOption(Parameter<?,?> opt)
          Perform the actual parameter assignment.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.AbstractParameterization
checkConstraint, clearErrors, failOnErrors, finalize, getErrors, grab, hasErrors, logAndClearReportedErrors, reportInternalParameterizationErrors, tryInstantiate, tryInstantiate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

chain

private Vector<Parameterization> chain
Keep the list of parameterizations.


errorTarget

private Parameterization errorTarget
Error target

Constructor Detail

ChainedParameterization

public ChainedParameterization(Parameterization... ps)
Constructor that takes a number of Parameterizations to chain.

Parameters:
ps - Parameterizations
Method Detail

appendParameterization

public void appendParameterization(Parameterization p)
Append a new Parameterization to the chain.

Parameters:
p - Parameterization

setValueForOption

public boolean setValueForOption(Parameter<?,?> opt)
                          throws ParameterException
Description copied from class: AbstractParameterization
Perform the actual parameter assignment.

Specified by:
setValueForOption in interface Parameterization
Specified by:
setValueForOption in class AbstractParameterization
Parameters:
opt - Option to be set
Returns:
Success code (value available)
Throws:
ParameterException - on assignment errors.

hasUnusedParameters

public boolean hasUnusedParameters()
Description copied from interface: Parameterization
Check for unused parameters

Returns:
true if at least one parameter was not consumed

errorsTo

public void errorsTo(Parameterization config)
Set the error target, since there is no unique way where errors can be reported.

Parameters:
config - Parameterization to report errors to

reportError

public void reportError(ParameterException e)
Report a configuration error.

Specified by:
reportError in interface Parameterization
Overrides:
reportError in class AbstractParameterization
Parameters:
e - Destination to report errors to

descend

public 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. Parallel descend in all chains.

Parameters:
option - Option subtree
Returns:
Parameterization

Release 0.4.0 (2011-09-20_1324)