Package repast.simphony.parameter
Class ParametersCreator
- java.lang.Object
-
- repast.simphony.parameter.ParametersCreator
-
public class ParametersCreator extends Object
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
Constructors Constructor Description ParametersCreator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
contains(String name)
Gets whether or not this creator contains the named parameter.BoundParameters
createBoundParameters(Class clazz)
Create a BoundParameters object containing the currently added parameters as well any annotatated Parameters in the specified class.Parameters
createParameters()
Create a Parameters object contains the added parameters.int
getParameterCount()
Gets number of currently added parameters.
-
-
-
Method Detail
-
addParameter
public void addParameter(String name, 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 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
public boolean contains(String name)
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
public void addParameters(Parameters params)
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
public void addConstraint(String name, List constrainingList)
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
public void addConvertor(String name, StringConverter converter)
Adds a converter to convert the named parameter back and forth to a String.- Parameters:
name
- the name of the parameterconverter
- the converter
-
addConstraint
public void addConstraint(String name, SteppedRange constrainingRange)
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
public BoundParameters createBoundParameters(Class clazz) throws IntrospectionException
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
public Parameters 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.
-
-