parameter
Class ParameterSet

java.lang.Object
  extended bymotris.data.Description
      extended byparameter.ParameterSet

public class ParameterSet
extends Description

A searchable, loadable, saveable, hierarchially aggregatable list of Parameters

Author:
ottlik, dahlkamp

Field Summary
 boolean claimToBeComplete
           
private  int nextIndex
           
private  int nextSubset
           
private  java.util.Vector parameters
           
private  ParameterSet parent
           
private  java.util.Vector subsets
           
private  java.lang.String type
           
 
Fields inherited from class motris.data.Description
 
Constructor Summary
ParameterSet()
           
ParameterSet(ParameterSet _parent)
           
ParameterSet(java.lang.String _name)
           
ParameterSet(java.lang.String _name, ParameterSet _parent)
           
ParameterSet(java.lang.String _name, java.lang.String _ident)
           
ParameterSet(java.lang.String _name, java.lang.String _ident, ParameterSet _parent)
           
 
Method Summary
 void add(Parameter _p)
          Add a parameter
 void add(ParameterSet _p)
           
 void clear()
           
 ParameterSet copy()
           
 boolean copyValuesFrom(ParameterSet _parameterset, boolean recursiveCopy)
          Copy VALUES (no Meta-Info as Name, Description, Ident...) from supplied ParameterSet into this one.
 Parameter getFirstParameter()
           
 ParameterSet getFirstParameterSet()
           
 int getIndexOfIdent(java.lang.String _ident, boolean warnIfNotFound)
          Returns array index of Parameter identified by _ident
 int getIndexOfName(java.lang.String _name)
          Returns array index of Parameter identified by _name
 int getIndexOfSubset(java.lang.String _ident)
          Returns array index of ParameterSet identified by _ident
 Parameter getNextParameter()
           
 ParameterSet getNextParameterSet()
           
 int getNumberOfParameters()
           
 int getNumberOfSubsets()
           
 boolean getParamBooleanValue(int index)
           
 boolean getParamBooleanValue(java.lang.String _ident)
           
 boolean getParamBooleanValue(java.lang.String _ident, boolean defaultValue)
           
 java.awt.Color getParamColorValue(java.lang.String _ident, java.awt.Color defaultValue)
           
 DoubleMatrix getParamDoubleMatrixValue(java.lang.String _ident, DoubleMatrix defaultValue)
           
 double getParamDoubleValue(int index)
           
 double getParamDoubleValue(java.lang.String _ident)
           
 double getParamDoubleValue(java.lang.String _ident, double defaultValue)
           
 Parameter getParameter(int index)
           
 Parameter getParameter(java.lang.String _ident)
           
 Parameter getParameter(java.lang.String _ident, java.lang.String _name)
           
 int getParamIntValue(int index)
           
 int getParamIntValue(java.lang.String _ident)
           
 int getParamIntValue(java.lang.String _ident, int defaultValue)
           
 java.lang.String getParamStringValue(int index)
           
 java.lang.String getParamStringValue(java.lang.String _ident)
           
 java.lang.String getParamStringValue(java.lang.String _ident, java.lang.String defaultValue)
           
 ParameterSet getParent()
           
 ParameterSet getSubset(int index)
           
 ParameterSet getSubset(java.lang.String _ident)
           
 java.lang.String getType()
           
 boolean isCompatibleWith(ParameterSet _paramset, boolean compareSubsets)
          Check compatibility of ParameterSets
static ParameterSet load(java.lang.String fileName)
           
 void mergeWithByReference(ParameterSet _params, boolean recursiveMerge)
          Merge this and the supplied ParameterSet by copying references from _params into this (if identifier matches) or by adding them otherwise
 void mergeWithByValue(ParameterSet _params, boolean recursiveMerge)
          Merge this and the supplied ParameterSet by copying values from _params into this (if identifier matches) or by adding deep clones of _params's clones otherwise
 boolean removeParameter(java.lang.String toRemove)
           
 boolean removeParameterSet(java.lang.String toRemove)
           
 void save(java.lang.String fileName)
           
 void setParent(ParameterSet set)
           
 void setSubsetAtPosition(int index, ParameterSet subset)
           
 void setType(java.lang.String string)
           
 java.lang.String toString()
           
 java.lang.String toXML()
           
 void toXML(java.lang.String linePrefix, java.lang.StringBuffer buffer)
          Create XML representation of this ParameterSet and its subsets where each line is indented by using linePrefix (for human readability) Hendrik: note that using StringBuffer is MUCH faster than using Strings
 
Methods inherited from class motris.data.Description
getDescription, getIdentifier, getName, setDescription, setIdentifier, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

private java.lang.String type

parameters

private java.util.Vector parameters

subsets

private java.util.Vector subsets

parent

private ParameterSet parent

nextSubset

private int nextSubset

nextIndex

private int nextIndex

claimToBeComplete

public boolean claimToBeComplete
Constructor Detail

ParameterSet

public ParameterSet()

ParameterSet

public ParameterSet(java.lang.String _name)

ParameterSet

public ParameterSet(java.lang.String _name,
                    java.lang.String _ident)

ParameterSet

public ParameterSet(ParameterSet _parent)

ParameterSet

public ParameterSet(java.lang.String _name,
                    ParameterSet _parent)

ParameterSet

public ParameterSet(java.lang.String _name,
                    java.lang.String _ident,
                    ParameterSet _parent)
Method Detail

add

public void add(Parameter _p)
Add a parameter


add

public void add(ParameterSet _p)

getParameter

public Parameter getParameter(java.lang.String _ident)

getParameter

public Parameter getParameter(java.lang.String _ident,
                              java.lang.String _name)

getParameter

public Parameter getParameter(int index)

getSubset

public ParameterSet getSubset(int index)

getSubset

public ParameterSet getSubset(java.lang.String _ident)

getNumberOfSubsets

public int getNumberOfSubsets()

isCompatibleWith

public boolean isCompatibleWith(ParameterSet _paramset,
                                boolean compareSubsets)
Check compatibility of ParameterSets

Parameters:
_paramset -
compareSubsets - do a recursive call
Returns:
true if all Parameters in the supplied ParameterSet are compatible with the parameters in this ParameterSet.

copyValuesFrom

public boolean copyValuesFrom(ParameterSet _parameterset,
                              boolean recursiveCopy)
Copy VALUES (no Meta-Info as Name, Description, Ident...) from supplied ParameterSet into this one. Note that only values, not the pointer to the values are copied. Also, the only compatibility check is based on a compatible Paramtert TYPE (no ident,name...) use isCompatibleWith() if you want more

Parameters:
_parameterset -
recursiveCopy -
Returns:
false if at least one copy fails, i.e. if parameters in source and destination have different type

mergeWithByValue

public void mergeWithByValue(ParameterSet _params,
                             boolean recursiveMerge)
Merge this and the supplied ParameterSet by copying values from _params into this (if identifier matches) or by adding deep clones of _params's clones otherwise

Parameters:
_params - ParameterSet to merge with
recursiveMerge - also merge subsets

mergeWithByReference

public void mergeWithByReference(ParameterSet _params,
                                 boolean recursiveMerge)
Merge this and the supplied ParameterSet by copying references from _params into this (if identifier matches) or by adding them otherwise

Parameters:
_params - ParameterSet to merge with
recursiveMerge - also merge subsets

getParamIntValue

public int getParamIntValue(int index)

getParamDoubleValue

public double getParamDoubleValue(int index)

getParamBooleanValue

public boolean getParamBooleanValue(int index)

getParamStringValue

public java.lang.String getParamStringValue(int index)

getParamColorValue

public java.awt.Color getParamColorValue(java.lang.String _ident,
                                         java.awt.Color defaultValue)

getParamIntValue

public int getParamIntValue(java.lang.String _ident)

getParamIntValue

public int getParamIntValue(java.lang.String _ident,
                            int defaultValue)

getParamDoubleValue

public double getParamDoubleValue(java.lang.String _ident)

getParamDoubleValue

public double getParamDoubleValue(java.lang.String _ident,
                                  double defaultValue)

getParamBooleanValue

public boolean getParamBooleanValue(java.lang.String _ident)

getParamBooleanValue

public boolean getParamBooleanValue(java.lang.String _ident,
                                    boolean defaultValue)

getParamDoubleMatrixValue

public DoubleMatrix getParamDoubleMatrixValue(java.lang.String _ident,
                                              DoubleMatrix defaultValue)

getParamStringValue

public java.lang.String getParamStringValue(java.lang.String _ident)

getParamStringValue

public java.lang.String getParamStringValue(java.lang.String _ident,
                                            java.lang.String defaultValue)

getParent

public ParameterSet getParent()

setParent

public void setParent(ParameterSet set)

getFirstParameter

public Parameter getFirstParameter()

getFirstParameterSet

public ParameterSet getFirstParameterSet()

getNextParameter

public Parameter getNextParameter()

getNumberOfParameters

public int getNumberOfParameters()

getIndexOfIdent

public int getIndexOfIdent(java.lang.String _ident,
                           boolean warnIfNotFound)
Returns array index of Parameter identified by _ident

Parameters:
_ident - Parameter Identifier (must be unique!)
Returns:
array index (starting with 0) or -1 if no parameter found

getIndexOfSubset

public int getIndexOfSubset(java.lang.String _ident)
Returns array index of ParameterSet identified by _ident

Parameters:
_ident - ParameterSet Identifier (must be unique!)
Returns:
array index (starting with 0) or -1 if no parameter found

getIndexOfName

public int getIndexOfName(java.lang.String _name)
Returns array index of Parameter identified by _name

Parameters:
_name - Parameter Name (must be unique!)
Returns:
array index (starting with 0) or -1 if no parameter found

getNextParameterSet

public ParameterSet getNextParameterSet()

load

public static ParameterSet load(java.lang.String fileName)

save

public void save(java.lang.String fileName)

toString

public java.lang.String toString()

toXML

public java.lang.String toXML()

toXML

public void toXML(java.lang.String linePrefix,
                  java.lang.StringBuffer buffer)
Create XML representation of this ParameterSet and its subsets where each line is indented by using linePrefix (for human readability) Hendrik: note that using StringBuffer is MUCH faster than using Strings

Parameters:
linePrefix - prefix for each line (indention using tabs)
buffer - append XML representation to this Buffer

copy

public ParameterSet copy()

getType

public java.lang.String getType()

setType

public void setType(java.lang.String string)

removeParameter

public boolean removeParameter(java.lang.String toRemove)

removeParameterSet

public boolean removeParameterSet(java.lang.String toRemove)

setSubsetAtPosition

public void setSubsetAtPosition(int index,
                                ParameterSet subset)

clear

public void clear()