Class ChainedParameterization
- java.lang.Object
-
- elki.utilities.optionhandling.parameterization.AbstractParameterization
-
- 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
elki.utilities.optionhandling
package documentation for examples.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Parameterization>
chain
Keep the list of parameterizations.private Parameterization
errorTarget
Error target-
Fields inherited from class elki.utilities.optionhandling.parameterization.AbstractParameterization
errors
-
-
Constructor Summary
Constructors Constructor Description ChainedParameterization(Parameterization... ps)
Constructor that takes a number of Parameterizations to chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendParameterization(Parameterization p)
Append a new Parameterization to the chain.Parameterization
descend(java.lang.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 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.-
Methods inherited from class elki.utilities.optionhandling.parameterization.AbstractParameterization
clearErrors, failOnErrors, getErrors, logAndClearReportedErrors
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.utilities.optionhandling.parameterization.Parameterization
grab, hasErrors, tryInstantiate
-
-
-
-
Field Detail
-
chain
private java.util.List<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 interface:Parameterization
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.
-
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)
Description copied from interface:Parameterization
Report a configuration error.- Specified by:
reportError
in interfaceParameterization
- Overrides:
reportError
in classAbstractParameterization
- Parameters:
e
- Destination to report errors to
-
descend
public 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.Parallel descend in all chains.
- Parameters:
option
- Option subtree- Returns:
- Parameterization
-
-