public class ParameterSet
extends java.lang.Object
implements java.lang.Cloneable, java.io.Externalizable
Parameter
,
Serialized FormConstructor and Description |
---|
ParameterSet()
Construct an empty nameless root parameter set.
|
ParameterSet(java.lang.String name)
Construct an empty named root parameter set.
|
Modifier and Type | Method and Description |
---|---|
Parameter |
addParameter(java.lang.String name)
Add a new parameter to this parameter set.
|
ParameterSet |
addParameterSet(java.lang.String name)
Add a new parameter subset to this parameter set.
|
void |
clear()
Clear this parameter set by removing all its parameters
and parameter subsets.
|
java.lang.Object |
clone()
Clone this parameter set.
|
ParameterSet |
copyTo(ParameterSet parent)
Copy this parameter.set to the specified parent parameter set
without changing its name.
|
ParameterSet |
copyTo(ParameterSet parent,
java.lang.String name)
Copy this parameter.set to the specified parent parameter set
while changing its name.
|
int |
countParameters()
Count the parameters in this parameter set.
|
int |
countParameterSets()
Count the parameter subsets in this parameter set.
|
boolean |
equals(java.lang.Object o)
Compares two parameter sets for equality.
|
void |
fromString(java.lang.String s)
Replace this parameter set with that represented in the specified
XML-formatted string (the same format written by method toString).
|
boolean |
getBoolean(java.lang.String name,
boolean defaultValue)
Get the boolean value of a named parameter in this parameter set.
|
boolean[] |
getBooleans(java.lang.String name,
boolean[] defaultValues)
Get the boolean values of a named parameter in this parameter set.
|
double |
getDouble(java.lang.String name,
double defaultValue)
Get the double value of a named parameter in this parameter set.
|
double[] |
getDoubles(java.lang.String name,
double[] defaultValues)
Get the double values of a named parameter in this parameter set.
|
float |
getFloat(java.lang.String name,
float defaultValue)
Get the float value of a named parameter in this parameter set.
|
float[] |
getFloats(java.lang.String name,
float[] defaultValues)
Get the float values of a named parameter in this parameter set.
|
int |
getInt(java.lang.String name,
int defaultValue)
Get the int value of a named parameter in this parameter set.
|
int[] |
getInts(java.lang.String name,
int[] defaultValues)
Get the int values of a named parameter in this parameter set.
|
long |
getLong(java.lang.String name,
long defaultValue)
Get the long value of a named parameter in this parameter set.
|
long[] |
getLongs(java.lang.String name,
long[] defaultValues)
Get the long values of a named parameter in this parameter set.
|
java.lang.String |
getName()
Get the parameter set name.
|
Parameter |
getParameter(java.lang.String name)
Get a parameter.
|
java.util.Iterator<Parameter> |
getParameters()
Gets an iterator for the parameters in this parameter set.
|
ParameterSet |
getParameterSet(java.lang.String name)
Get a parameter subset.
|
java.util.Iterator<ParameterSet> |
getParameterSets()
Gets an iterator for the parameter sets in this parameter set.
|
ParameterSet |
getParent()
Get the parameter set that contains this parameter set.
|
java.lang.String |
getString(java.lang.String name,
java.lang.String defaultValue)
Get the String value of a named parameter in this parameter set.
|
java.lang.String[] |
getStrings(java.lang.String name,
java.lang.String[] defaultValues)
Get the String values of a named parameter in this parameter set.
|
java.lang.String |
getUnits(java.lang.String name,
java.lang.String defaultUnits)
Get the units of a named parameter in this parameter set.
|
int |
hashCode()
Computes the hash code of this parameter set.
|
ParameterSet |
moveTo(ParameterSet parent)
Move this parameter set to the specified parent parameter set
without changing its name.
|
ParameterSet |
moveTo(ParameterSet parent,
java.lang.String name)
Move this parameter set to the specified parent parameter set
while changing its name.
|
void |
readExternal(java.io.ObjectInput in)
Restores this parameter set by reading its XML string
representation from the specified object input.
|
void |
remove()
Remove this parameter set from its parent parameter set.
|
void |
remove(java.lang.String name)
Remove a named parameter or subset from this parameter set.
|
ParameterSet |
replaceWith(ParameterSet parset)
Replace the contents of this parameter set with a copy of
the contents of the specified parameter set.
|
void |
setBoolean(java.lang.String name,
boolean value)
Set the boolean value of a named parameter in this parameter set.
|
void |
setBooleans(java.lang.String name,
boolean[] values)
Set the boolean values of a named parameter in this parameter set.
|
void |
setDouble(java.lang.String name,
double value)
Set the double value of a named parameter in this parameter set.
|
void |
setDoubles(java.lang.String name,
double[] values)
Set the double values of a named parameter in this parameter set.
|
void |
setFloat(java.lang.String name,
float value)
Set the float value of a named parameter in this parameter set.
|
void |
setFloats(java.lang.String name,
float[] values)
Set the float values of a named parameter in this parameter set.
|
void |
setInt(java.lang.String name,
int value)
Set the int value of a named parameter in this parameter set.
|
void |
setInts(java.lang.String name,
int[] values)
Set the int values of a named parameter in this parameter set.
|
void |
setLong(java.lang.String name,
long value)
Set the long value of a named parameter in this parameter set.
|
void |
setLongs(java.lang.String name,
long[] values)
Set the long values of a named parameter in this parameter set.
|
void |
setName(java.lang.String name)
Set the parameter set name.
|
void |
setString(java.lang.String name,
java.lang.String value)
Set the String value of a named parameter in this parameter set.
|
void |
setStrings(java.lang.String name,
java.lang.String[] values)
Set the String values of a named parameter in this parameter set.
|
void |
setUnits(java.lang.String name,
java.lang.String units)
Set the units of a named parameter in this parameter set.
|
java.lang.String |
toString()
Get a string representation of this parameter set.
|
void |
writeExternal(java.io.ObjectOutput out)
Serializes this parameter set by writing its XML string
representation to the specified object output.
|
public ParameterSet()
public ParameterSet(java.lang.String name)
name
- parameter set name.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public ParameterSet replaceWith(ParameterSet parset)
parset
- the parameter set with contents that will replace
those in this parameter set.public java.lang.String getName()
public void setName(java.lang.String name)
name
- parameter set name.
If the parameter set has a parent parameter set, ignore a null name.public Parameter getParameter(java.lang.String name)
name
- name of the parameter to get.public ParameterSet getParameterSet(java.lang.String name)
name
- name of the subset to get.public Parameter addParameter(java.lang.String name)
name
- name of the parameter to add.public ParameterSet addParameterSet(java.lang.String name)
name
- name of the parameter subset to add.public boolean getBoolean(java.lang.String name, boolean defaultValue) throws ParameterConvertException
name
- name of the parameter.defaultValue
- default value returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter value cannot be
converted to boolean.public int getInt(java.lang.String name, int defaultValue) throws ParameterConvertException
name
- name of the parameter.defaultValue
- default value returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter value cannot be
converted to int.public long getLong(java.lang.String name, long defaultValue) throws ParameterConvertException
name
- name of the parameter.defaultValue
- default value returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter value cannot be
converted to long.public float getFloat(java.lang.String name, float defaultValue) throws ParameterConvertException
name
- name of the parameter.defaultValue
- default value returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter value cannot be
converted to float.public double getDouble(java.lang.String name, double defaultValue) throws ParameterConvertException
name
- name of the parameter.defaultValue
- default value returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter value cannot be
converted to double.public java.lang.String getString(java.lang.String name, java.lang.String defaultValue) throws ParameterConvertException
name
- name of the parameter.defaultValue
- default value returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter value cannot be
converted to String.public boolean[] getBooleans(java.lang.String name, boolean[] defaultValues) throws ParameterConvertException
name
- name of the parameter.defaultValues
- default values returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter values cannot be
converted to boolean.public int[] getInts(java.lang.String name, int[] defaultValues) throws ParameterConvertException
name
- name of the parameter.defaultValues
- default values returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter values cannot be
converted to int.public long[] getLongs(java.lang.String name, long[] defaultValues) throws ParameterConvertException
name
- name of the parameter.defaultValues
- default values returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter values cannot be
converted to long.public float[] getFloats(java.lang.String name, float[] defaultValues) throws ParameterConvertException
name
- name of the parameter.defaultValues
- default values returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter values cannot be
converted to float.public double[] getDoubles(java.lang.String name, double[] defaultValues) throws ParameterConvertException
name
- name of the parameter.defaultValues
- default values returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter values cannot be
converted to double.public java.lang.String[] getStrings(java.lang.String name, java.lang.String[] defaultValues) throws ParameterConvertException
name
- name of the parameter.defaultValues
- default values returned if this parameter set
does not contain a parameter with the specified name.ParameterConvertException
- if the parameter values cannot be
converted to String.public java.lang.String getUnits(java.lang.String name, java.lang.String defaultUnits)
name
- name of the parameter.defaultUnits
- default units returned if this parameter set
does not contain a parameter with the specified name.public void setBoolean(java.lang.String name, boolean value)
name
- name of the parameter.value
- parameter value.public void setInt(java.lang.String name, int value)
name
- name of the parameter.value
- parameter value.public void setLong(java.lang.String name, long value)
name
- name of the parameter.value
- parameter value.public void setFloat(java.lang.String name, float value)
name
- name of the parameter.value
- parameter value.public void setDouble(java.lang.String name, double value)
name
- name of the parameter.value
- parameter value.public void setString(java.lang.String name, java.lang.String value)
name
- name of the parameter.value
- parameter value.public void setBooleans(java.lang.String name, boolean[] values)
name
- name of the parameter.values
- parameter values.public void setInts(java.lang.String name, int[] values)
name
- name of the parameter.values
- parameter values.public void setLongs(java.lang.String name, long[] values)
name
- name of the parameter.values
- parameter values.public void setFloats(java.lang.String name, float[] values)
name
- name of the parameter.values
- parameter values.public void setDoubles(java.lang.String name, double[] values)
name
- name of the parameter.values
- parameter values.public void setStrings(java.lang.String name, java.lang.String[] values)
name
- name of the parameter.values
- parameter values.public void setUnits(java.lang.String name, java.lang.String units)
name
- name of the parameter.units
- parameter units.public ParameterSet copyTo(ParameterSet parent)
parent
- the parameter set into which to copy this parameter set;
the parent of the destination parameter set.
If the parent is null, the destination parameter set will be an orphan.public ParameterSet copyTo(ParameterSet parent, java.lang.String name)
parent
- the parameter set into which to copy this parameter set;
the parent of the destination parameter set.
If the parent is null, the destination parameter set will be an orphan.name
- the destination parameter set name.public ParameterSet moveTo(ParameterSet parent)
parent
- the parameter set into which to move this parameter set;
the parent of the destination parameter set.
If the parent is null, the destination parameter set will be an orphan.public ParameterSet moveTo(ParameterSet parent, java.lang.String name)
parent
- the parameter set into which to move this parameter set;
the parent of the destination parameter set.
If the parent is null, the destination parameter set will be an orphan.
The parent cannot be this parameter set or a subset of this parameter set.name
- the destination parameter set name.public void remove()
public void remove(java.lang.String name)
name
- name of the parameter or subset to remove.public int countParameters()
public int countParameterSets()
public void clear()
public ParameterSet getParent()
public java.util.Iterator<Parameter> getParameters()
public java.util.Iterator<ParameterSet> getParameterSets()
public void fromString(java.lang.String s) throws ParameterSetFormatException
s
- XML-formatted string representation of parameter set.ParameterSetFormatException
- if the string is not properly
formatted.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- the object output to which to write this parameter set.java.io.IOException
- if any I/O exception occurs.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException, ParameterSetFormatException
readExternal
in interface java.io.Externalizable
in
- the object input from which to read this parameter set.java.io.IOException
- if any I/exception occurs.java.lang.ClassNotFoundException
- if the class for an object being
restored cannot be found.ParameterSetFormatException
- if the XML string representation
of this parameter set is not properly formatted.