public class TrackParameters extends Object implements Parameterization
Modifier and Type | Field and Description |
---|---|
(package private) Map<Object,List<Object>> |
children
Tree information: child links
|
(package private) Object |
cur
Current parent for nested parameterization
|
(package private) Parameterization |
inner
Inner parameterization
|
(package private) List<Pair<Object,Parameter<?>>> |
options
Tracking storage
|
(package private) Map<Object,Object> |
parents
Tree information: parent links
|
Modifier | Constructor and Description |
---|---|
|
TrackParameters(Parameterization inner)
Constructor.
|
private |
TrackParameters(Parameterization inner,
Object option,
List<Pair<Object,Parameter<?>>> options,
Map<Object,Object> parents,
Map<Object,List<Object>> children)
Internal constructor, for nested tracking.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkConstraint(GlobalParameterConstraint constraint)
Check a parameter constraint.
|
Parameterization |
descend(Object option)
Descend parameterization tree into sub-option.
|
Collection<Pair<Object,Parameter<?>>> |
getAllParameters()
Get all seen parameters, set or unset, along with their owner objects.
|
Collection<ParameterException> |
getErrors()
Get the configuration errors thrown in
Parameterization.grab(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter<?>) |
Collection<Pair<OptionID,Object>> |
getGivenParameters()
Get the tracked parameters that were actually set.
|
Object |
getParent(Object pos)
Traverse the tree upwards.
|
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
|
private void |
registerChild(Object opt) |
void |
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.
|
<C> C |
tryInstantiate(Class<C> c)
Try to instantiate a particular class.
|
<C> C |
tryInstantiate(Class<C> r,
Class<?> c)
Try to instantiate a particular class.
|
Parameterization inner
Object cur
public TrackParameters(Parameterization inner)
inner
- Inner parameterization to wrap.private TrackParameters(Parameterization inner, Object option, List<Pair<Object,Parameter<?>>> options, Map<Object,Object> parents, Map<Object,List<Object>> children)
inner
- Inner parameterizationoption
- Optionoptions
- List of optionsparents
- Parent mapchildren
- Child mappublic 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 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 addpublic boolean hasUnusedParameters()
Parameterization
hasUnusedParameters
in interface Parameterization
true
if at least one parameter was not consumedpublic void reportError(ParameterException e)
Parameterization
reportError
in interface Parameterization
e
- Destination to report errors topublic boolean setValueForOption(Parameter<?> opt) throws ParameterException
Parameterization
setValueForOption
in interface Parameterization
opt
- Parameter to setParameterException
- on assignment errors.public Collection<Pair<Object,Parameter<?>>> getAllParameters()
public Collection<Pair<OptionID,Object>> getGivenParameters()
public boolean checkConstraint(GlobalParameterConstraint constraint)
Parameterization
checkConstraint
in interface Parameterization
constraint
- Parameter constraintpublic Parameterization descend(Object option)
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. Track parameters using a shared options list with parent
tracker.descend
in interface Parameterization
option
- Option subtreeprivate void registerChild(Object opt)
public Object getParent(Object pos)
pos
- Current objectpublic <C> C tryInstantiate(Class<C> r, Class<?> c)
Parameterization
tryInstantiate
in interface Parameterization
C
- return typer
- Restriction classc
- Base classpublic <C> C tryInstantiate(Class<C> c)
Parameterization
tryInstantiate
in interface Parameterization
C
- return typec
- Base class