Class MergedParameterization
- java.lang.Object
-
- elki.utilities.optionhandling.parameterization.MergedParameterization
-
- All Implemented Interfaces:
Parameterization
public class MergedParameterization extends java.lang.Object implements Parameterization
This configuration can be "rewound" to allow the same values to be consumed multiple times, by different classes. This is used in best-effort parameterization when some instances might not apply given the actual data, e.g., in visualization classes.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private ListParameterizationcurrentParameters we used before, but have rewoundprivate ParameterizationinnerThe parameterization we get the new values from.private java.util.List<ListParameterization.ParameterPair>usedParameters to rewind.
-
Constructor Summary
Constructors Modifier Constructor Description MergedParameterization(Parameterization child)Constructor.privateMergedParameterization(Parameterization inner, ListParameterization current, java.util.List<ListParameterization.ParameterPair> used)Constructor for descending
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Parameterizationdescend(java.lang.Object option)Descend parameterization tree into sub-option.java.util.Collection<ParameterException>getErrors()Get the configuration errors thrown inParameterization.grab(elki.utilities.optionhandling.parameters.Parameter<?>)booleanhasUnusedParameters()Check for unused parametersvoidreportError(ParameterException e)Report a configuration error.voidrewind()Rewind the configuration to the initial situationbooleansetValueForOption(Parameter<?> opt)Assign a value for an option, but not using default values and throwing exceptions on error.-
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
-
inner
private final Parameterization inner
The parameterization we get the new values from.
-
current
private final ListParameterization current
Parameters we used before, but have rewound
-
used
private final java.util.List<ListParameterization.ParameterPair> used
Parameters to rewind.
-
-
Constructor Detail
-
MergedParameterization
public MergedParameterization(Parameterization child)
Constructor.- Parameters:
child- Child parameterization to wrap.
-
MergedParameterization
private MergedParameterization(Parameterization inner, ListParameterization current, java.util.List<ListParameterization.ParameterPair> used)
Constructor for descending- Parameters:
inner- Child parameterization to use.current- Current parameterization to re-usedused- Used parameters list.
-
-
Method Detail
-
rewind
public void rewind()
Rewind the configuration to the initial situation
-
setValueForOption
public boolean setValueForOption(Parameter<?> opt) throws ParameterException
Description copied from interface:ParameterizationAssign a value for an option, but not using default values and throwing exceptions on error.- Specified by:
setValueForOptionin interfaceParameterization- Parameters:
opt- Parameter to set- Returns:
- Success code
- Throws:
ParameterException- on assignment errors.
-
descend
public Parameterization descend(java.lang.Object option)
Description copied from interface:ParameterizationDescend 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.- Specified by:
descendin interfaceParameterization- Parameters:
option- Option subtree- Returns:
- Parameterization
-
getErrors
public java.util.Collection<ParameterException> getErrors()
Description copied from interface:ParameterizationGet the configuration errors thrown inParameterization.grab(elki.utilities.optionhandling.parameters.Parameter<?>)- Specified by:
getErrorsin interfaceParameterization- Returns:
- Configuration errors encountered
-
reportError
public void reportError(ParameterException e)
Description copied from interface:ParameterizationReport a configuration error.- Specified by:
reportErrorin interfaceParameterization- Parameters:
e- Destination to report errors to
-
hasUnusedParameters
public boolean hasUnusedParameters()
Description copied from interface:ParameterizationCheck for unused parameters- Specified by:
hasUnusedParametersin interfaceParameterization- Returns:
trueif at least one parameter was not consumed
-
-