Package repast.simphony.parameter
Class DefaultSchema
java.lang.Object
repast.simphony.parameter.DefaultSchema
- All Implemented Interfaces:
Schema
Default implementation of Schema.
- Version:
- $Revision$ $Date$
- Author:
- Nick Collier
-
Constructor Summary
ConstructorDescriptionCreates an empty Schema.DefaultSchema
(Pair<String, Class>[] pairs) Creates a schema from an array of String, Class pairs. -
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.void
Adds a schema entry to this Schema.boolean
Returns true if this schema contains contains the specified parameter name, otherwise false.getDetails
(String paramName) Gets the schema for the specified parameter.Gets an iterable over a list of parameter names.boolean
removeEntry
(String name) Removes a schema entry from this Schemaint
size()
Gets the number of parameters in this schema.boolean
Validates the specified object against the type info contained for the parameter name.
-
Constructor Details
-
DefaultSchema
public DefaultSchema()Creates an empty Schema. -
DefaultSchema
Creates a schema from an array of String, Class pairs.- Parameters:
pairs
- first item in pair is parameter name, second is parameter type
-
-
Method Details
-
removeEntry
Removes a schema entry from this Schema- Parameters:
name
- the name of the parameter- Returns:
- whether or not the removal was successful
-
addEntry
Adds a schema entry to this Schema.- Parameters:
name
- the name of the parametertype
- the type of the parameterdefValue
- the default value of hte parameter.
-
addConstraint
Constains 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 parmaeterconstrainingRange
- a range of the possible values for the named parameter
-
getDetails
Gets the schema for the specified parameter.- Specified by:
getDetails
in interfaceSchema
- Parameters:
paramName
- the name of the parameter- Returns:
- the schema for the specified parameter
-
parameterNames
Gets an iterable over a list of parameter names.- Specified by:
parameterNames
in interfaceSchema
- Returns:
- an iterable over a list of parameter names.
-
validate
Validates the specified object against the type info contained for the parameter name. -
contains
Returns true if this schema contains contains the specified parameter name, otherwise false. -
size
public int size()Gets the number of parameters in this schema.
-