de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization
Class ListParameterization

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.AbstractParameterization
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization
All Implemented Interfaces:
Parameterization

public class ListParameterization
extends AbstractParameterization

Parameterization handler using a List and OptionIDs, for programmatic use.


Field Summary
(package private)  LinkedList<Pair<OptionID,Object>> parameters
          The actual parameters, for storage
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.AbstractParameterization
errors
 
Constructor Summary
ListParameterization()
          Default constructor.
ListParameterization(Collection<Pair<OptionID,Object>> dbParameters)
          Constructor with an existing collection.
 
Method Summary
 void addFlag(OptionID optionid)
          Add a flag to the parameter list
 void addParameter(OptionID optionid, Object value)
          Add a parameter to the parameter list
 Parameterization descend(Object option)
          Descend parameterization tree into sub-option.
 void forwardOption(Flag flag)
          Convenience - add a Flag option directly.
 void forwardOption(Parameter<?,?> param)
          Convenience - add a Parameter for forwarding
 List<Pair<OptionID,Object>> getRemainingParameters()
          Return the yet unused parameters.
 boolean hasUnusedParameters()
          Check for unused parameters
 ArrayList<String> serialize()
          Serialize parameters.
 boolean setValueForOption(Parameter<?,?> opt)
          Perform the actual parameter assignment.
 String toString()
           
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.AbstractParameterization
checkConstraint, clearErrors, failOnErrors, finalize, getErrors, grab, hasErrors, logAndClearReportedErrors, reportError, reportInternalParameterizationErrors, tryInstantiate, tryInstantiate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parameters

LinkedList<Pair<OptionID,Object>> parameters
The actual parameters, for storage

Constructor Detail

ListParameterization

public ListParameterization()
Default constructor.


ListParameterization

public ListParameterization(Collection<Pair<OptionID,Object>> dbParameters)
Constructor with an existing collection.

Parameters:
dbParameters - existing parameter collection
Method Detail

addFlag

public void addFlag(OptionID optionid)
Add a flag to the parameter list

Parameters:
optionid - Option ID

addParameter

public void addParameter(OptionID optionid,
                         Object value)
Add a parameter to the parameter list

Parameters:
optionid - Option ID
value - Value

forwardOption

public void forwardOption(Flag flag)
Convenience - add a Flag option directly.

Parameters:
flag - Flag to add, if set

forwardOption

public void forwardOption(Parameter<?,?> param)
Convenience - add a Parameter for forwarding

Parameters:
param - Parameter to add

setValueForOption

public boolean setValueForOption(Parameter<?,?> opt)
                          throws ParameterException
Description copied from class: AbstractParameterization
Perform the actual parameter assignment.

Specified by:
setValueForOption in interface Parameterization
Specified by:
setValueForOption in class AbstractParameterization
Parameters:
opt - Option to be set
Returns:
Success code (value available)
Throws:
ParameterException - on assignment errors.

getRemainingParameters

public List<Pair<OptionID,Object>> getRemainingParameters()
Return the yet unused parameters.

Returns:
Unused parameters.

hasUnusedParameters

public boolean hasUnusedParameters()
Description copied from interface: Parameterization
Check for unused parameters

Returns:
true if at least one parameter was not consumed

descend

public Parameterization descend(Object option)
Descend parameterization tree into sub-option. Note: this is done automatically by a 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. Default implementation, for flat parameterizations.

Parameters:
option - Option subtree
Returns:
Parameterization

toString

public String toString()
Overrides:
toString in class Object

serialize

public ArrayList<String> serialize()
Serialize parameters.

Returns:
Array list of parameters

Release 0.4.0 (2011-09-20_1324)