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 ListParameterization
current
Parameters we used before, but have rewoundprivate Parameterization
inner
The parameterization we get the new values from.private java.util.List<ListParameterization.ParameterPair>
used
Parameters to rewind.
-
Constructor Summary
Constructors Modifier Constructor Description MergedParameterization(Parameterization child)
Constructor.private
MergedParameterization(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 Parameterization
descend(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<?>)
boolean
hasUnusedParameters()
Check for unused parametersvoid
reportError(ParameterException e)
Report a configuration error.void
rewind()
Rewind the configuration to the initial situationboolean
setValueForOption(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:Parameterization
Assign a value for an option, but not using default values and throwing exceptions on error.- Specified by:
setValueForOption
in 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:Parameterization
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.- Specified by:
descend
in interfaceParameterization
- Parameters:
option
- Option subtree- Returns:
- Parameterization
-
getErrors
public java.util.Collection<ParameterException> getErrors()
Description copied from interface:Parameterization
Get the configuration errors thrown inParameterization.grab(elki.utilities.optionhandling.parameters.Parameter<?>)
- Specified by:
getErrors
in interfaceParameterization
- Returns:
- Configuration errors encountered
-
reportError
public void reportError(ParameterException e)
Description copied from interface:Parameterization
Report a configuration error.- Specified by:
reportError
in interfaceParameterization
- Parameters:
e
- Destination to report errors to
-
hasUnusedParameters
public boolean hasUnusedParameters()
Description copied from interface:Parameterization
Check for unused parameters- Specified by:
hasUnusedParameters
in interfaceParameterization
- Returns:
true
if at least one parameter was not consumed
-
-