|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.MergedParameterization
public class MergedParameterization
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.
Field Summary | |
---|---|
private ListParameterization |
current
Parameters we used before, but have rewound |
private Parameterization |
inner
The parameterization we get the new values from. |
private Vector<Pair<OptionID,Object>> |
used
Parameters to rewind. |
Constructor Summary | |
---|---|
|
MergedParameterization(Parameterization child)
Constructor. |
private |
MergedParameterization(Parameterization inner,
ListParameterization current,
Vector<Pair<OptionID,Object>> used)
Constructor for descending |
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 Parameterization.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. |
|
void |
rewind()
Rewind the configuration to the initial situation |
|
boolean |
setValueForOption(Parameter<?,?> opt)
Assign a value for an option, but not using default values and throwing exceptions on error. |
|
|
tryInstantiate(Class<C> c)
Try to instantiate a particular class. |
|
|
tryInstantiate(Class<C> r,
Class<?> c)
Try to instantiate a particular class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Parameterization inner
private final ListParameterization current
private final Vector<Pair<OptionID,Object>> used
Constructor Detail |
---|
public MergedParameterization(Parameterization child)
child
- Child parameterization to wrap.private MergedParameterization(Parameterization inner, ListParameterization current, Vector<Pair<OptionID,Object>> used)
inner
- Child parameterization to use.current
- Current parameterization to re-usedused
- Used parameters list.Method Detail |
---|
public void rewind()
public boolean setValueForOption(Parameter<?,?> opt) throws ParameterException
Parameterization
setValueForOption
in interface Parameterization
opt
- Parameter to set
ParameterException
- on assignment errors.public Parameterization descend(Object option)
Parameterization
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.
descend
in interface Parameterization
option
- Option subtree
public Collection<ParameterException> getErrors()
Parameterization
Parameterization.grab(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter, ?>)
getErrors
in interface Parameterization
public boolean hasErrors()
Parameterization
hasErrors
in interface Parameterization
public void reportError(ParameterException e)
Parameterization
reportError
in interface Parameterization
e
- Destination to report errors topublic boolean grab(Parameter<?,?> opt)
Parameterization
opt
itself!
In particular Parameterization.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 ParameterException
s and store them to be
retrieved by Parameterization.getErrors()
.
grab
in interface Parameterization
opt
- Option to add
public boolean hasUnusedParameters()
Parameterization
hasUnusedParameters
in interface Parameterization
true
if at least one parameter was not consumedpublic boolean checkConstraint(GlobalParameterConstraint constraint)
Parameterization
checkConstraint
in interface Parameterization
constraint
- Parameter constraint
public <C> C tryInstantiate(Class<C> r, Class<?> c)
Parameterization
tryInstantiate
in interface Parameterization
C
- return typer
- Restriction classc
- Base class
public <C> C tryInstantiate(Class<C> c)
Parameterization
tryInstantiate
in interface Parameterization
C
- return typec
- Base class
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |