Package repast.simphony.parameter
Class DefaultParameters
java.lang.Object
repast.simphony.parameter.DefaultParameters
- All Implemented Interfaces:
Cloneable
,MutableParameters
,Parameters
- Direct Known Subclasses:
BoundParameters
Default implementation of Parameters. Individual paramters are created via
the add method. This is intended to be used in conjuction with a
ParametersCreator.
- Author:
- Nick Collier
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected PropertyChangeSupport
protected DefaultSchema
Fields inherited from interface repast.simphony.parameter.Parameters
NULL
-
Constructor Summary
ConstructorDescriptionCreates a new DefaultParameters object.DefaultParameters
(Parameters params) Creates a new DefaultParameters using the parameters in the specified Parameters object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstraint
(String name, List constrainingList) Constains the value of the named to parameter to those in the list.void
addConstraint
(String name, SteppedRange constrainingRange) Constrains the value of the named parameter to those in the specified range.void
addConvertor
(String name, StringConverter converter) Adds a converter to convert the named parameter back and forth to a String.protected void
addParameter
(String name, Class type, Object value, boolean isReadOnly) Adds a parameter to this Parameters.void
addParameter
(String name, String displayName, Class type, Object value, boolean isReadOnly) Adds a parameter to this Parameters.void
Adds listener that will listen for parameter changes on this Parameters.clone()
Method to clone a Parameter object.getBoolean
(String paramName) Gets the Boolean value associated with the specified parameter name.getDisplayName
(String paramName) Gets the display name for the specified parameter name.Gets the Double value associated with the specified parameter name.Gets the Float value associated with the specified parameter name.getInteger
(String paramName) Gets the Integer value associated with the specified parameter name.Gets the Boolean value associated with the specified parameter name.Gets the Schema for this Parameters object.Gets the String value associated with the specified parameter name.Gets the value associated with the specified parameter name.getValueAsString
(String paramName) Gets a String representation of the specified parameter's value.boolean
isReadOnly
(String paramName) True if parameter is read only.boolean
removeParameter
(String name) Removes the named parametervoid
Removes the specified listener from the listeners listening to this Parameters object.void
Sets the specified parameter name to the specified value.
-
Field Details
-
pcs
-
values
-
nameMap
-
schema
-
readOnly
-
changed
protected boolean changed
-
-
Constructor Details
-
DefaultParameters
public DefaultParameters()Creates a new DefaultParameters object. -
DefaultParameters
Creates a new DefaultParameters using the parameters in the specified Parameters object.- Parameters:
param
- parameters whose values we want to copy into this DefaultParameters
-
-
Method Details
-
clone
Description copied from interface:Parameters
Method to clone a Parameter object.- Specified by:
clone
in interfaceParameters
- Overrides:
clone
in classObject
- Returns:
- a Parameter clone.
-
addPropertyChangeListener
Adds listener that will listen for parameter changes on this Parameters.- Specified by:
addPropertyChangeListener
in interfaceParameters
- Parameters:
listener
-
-
removePropertyChangeListener
Removes the specified listener from the listeners listening to this Parameters object.- Specified by:
removePropertyChangeListener
in interfaceParameters
- Parameters:
listener
-
-
removeParameter
Removes the named parameter- Specified by:
removeParameter
in interfaceMutableParameters
- Parameters:
name
- the name of the parameter- Returns:
- whether or not removal was successful
-
addParameter
public void addParameter(String name, String displayName, Class type, Object value, boolean isReadOnly) Adds a parameter to this Parameters.- Specified by:
addParameter
in interfaceMutableParameters
- Parameters:
name
- the name of the parameterdisplayName
- the display name for the parametertype
- the type of the parametervalue
- the default value of the parameterisReadOnly
- whether or not the parameter is read only.
-
addConstraint
Constains the value of the named to parameter to those in the list.- Specified by:
addConstraint
in interfaceMutableParameters
- Parameters:
name
- the name of the parameterconstrainingList
- a list containing the possible values for the named parameter
-
addConvertor
Adds a converter to convert the named parameter back and forth to a String.- Specified by:
addConvertor
in interfaceMutableParameters
- Parameters:
name
- the name of the parameterconverter
- the converter
-
addConstraint
Constrains the value of the named parameter to those in the specified range.- Specified by:
addConstraint
in interfaceMutableParameters
- Parameters:
name
- the name of the parmaeterconstrainingRange
- a range of the possible values for the named parameter
-
addParameter
Adds a parameter to this Parameters.- Parameters:
name
- the name of the parametertype
- the type of the parametervalue
- the default value of the parameterisReadOnly
- whether or not the parameter is read only.
-
getSchema
Gets the Schema for this Parameters object.- Specified by:
getSchema
in interfaceParameters
- Returns:
- the Schema for this Parameters object.
-
getValue
Gets the value associated with the specified parameter name.- Specified by:
getValue
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getDouble
Gets the Double value associated with the specified parameter name.- Specified by:
getDouble
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getInteger
Gets the Integer value associated with the specified parameter name.- Specified by:
getInteger
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getBoolean
Gets the Boolean value associated with the specified parameter name.- Specified by:
getBoolean
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getString
Gets the String value associated with the specified parameter name.- Specified by:
getString
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getLong
Gets the Boolean value associated with the specified parameter name.- Specified by:
getLong
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getFloat
Gets the Float value associated with the specified parameter name.- Specified by:
getFloat
in interfaceParameters
- Parameters:
paramName
- the name of the parameter whose value we want- Returns:
- the value associated with the specified parameter name.
-
getValueAsString
Gets a String representation of the specified parameter's value.- Specified by:
getValueAsString
in interfaceParameters
- Parameters:
paramName
- the name of the parameter- Returns:
- a String representation of the specified parameters's value.
-
isReadOnly
True if parameter is read only.- Specified by:
isReadOnly
in interfaceParameters
- Parameters:
paramName
- the name of the parameter- Returns:
- true if parameter is read-only otherwise false.
-
setValue
Sets the specified parameter name to the specified value.- Specified by:
setValue
in interfaceParameters
- Parameters:
paramName
- the name of the parameter to set to the new valueval
- the new value
-
getDisplayName
Gets the display name for the specified parameter name.- Specified by:
getDisplayName
in interfaceParameters
- Parameters:
paramName
- the parameter name- Returns:
- the display name for the specified parameter name.
-