Package repast.simphony.parameter
Class ParametersCreator
java.lang.Object
repast.simphony.parameter.ParametersCreator
Creates Parameters objects. Parameters are themselves intended to be
immutable w/r to their schema after their creation. This allows for the
incremental creation of a parameters object.
- Version:
- $Revision$ $Date$
- Author:
- Nick Collier
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstraint
(String name, List constrainingList) Constrains 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.void
addParameter
(String name, Class type, Object value, boolean isReadOnly) Adds a parameter to this creator.void
addParameter
(String name, String displayName, Class type, Object value, boolean isReadOnly) Adds a parameter to this creator.void
addParameters
(Parameters params) Adds all the parameters in the specified Parameters objects to this creator.boolean
Gets whether or not this creator contains the named parameter.createBoundParameters
(Class clazz) Create a BoundParameters object containing the currently added parameters as well any annotatated Parameters in the specified class.Create a Parameters object contains the added parameters.int
Gets number of currently added parameters.
-
Constructor Details
-
ParametersCreator
public ParametersCreator()
-
-
Method Details
-
addParameter
Adds a parameter to this creator. The next call to createParameters() will create a Parameters object that includes the specified parameter.- Parameters:
name
- the name of the parametertype
- the type of the parametervalue
- the default value of the parameterisReadOnly
- whether or not the parameter value is read only
-
addParameter
public void addParameter(String name, String displayName, Class type, Object value, boolean isReadOnly) Adds a parameter to this creator. The next call to createParameters() will create a Parameters object that includes the specified parameter.- Parameters:
name
- the name of the parameterdisplayName
- the display name of the parametertype
- the type of the parametervalue
- the default value of the parameterisReadOnly
- whether or not the parameter value is read only
-
contains
Gets whether or not this creator contains the named parameter.- Parameters:
name
- the name of the parameter- Returns:
- true if this creator contains the named parameter, otherwise false.
-
addParameters
Adds all the parameters in the specified Parameters objects to this creator. The next call to createParameters() will create a Parameters object that includes those parameters.- Parameters:
params
- the parameters to add to this creator.
-
addConstraint
Constrains the value of the named to parameter to those in the list.- 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.- Parameters:
name
- the name of the parameterconverter
- the converter
-
addConstraint
Constrains the value of the named parameter to those in the specified range.- Parameters:
name
- the name of the parameterconstrainingRange
- a range of the possible values for the named parameter
-
createBoundParameters
Create a BoundParameters object containing the currently added parameters as well any annotatated Parameters in the specified class.- Parameters:
clazz
- the class- Returns:
- the created BoundParameters.
- Throws:
IntrospectionException
- if there is an error introspecting the specified class for Parameter annotations.
-
createParameters
Create a Parameters object contains the added parameters. The list of parameters is cleared.- Returns:
- the created Parameters.
-
getParameterCount
public int getParameterCount()Gets number of currently added parameters.- Returns:
- number of currently added parameters.
-