Package repast.simphony.parameter
Class DefaultSchema
- java.lang.Object
-
- repast.simphony.parameter.DefaultSchema
-
-
Constructor Summary
Constructors Constructor Description DefaultSchema()
Creates an empty Schema.DefaultSchema(Pair<String,Class>[] pairs)
Creates a schema from an array of String, Class pairs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
addEntry(String name, Class type, Object defValue)
Adds a schema entry to this Schema.boolean
contains(String paramName)
Returns true if this schema contains contains the specified parameter name, otherwise false.ParameterSchema
getDetails(String paramName)
Gets the schema for the specified parameter.Iterable<String>
parameterNames()
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
validate(String paramName, Object obj)
Validates the specified object against the type info contained for the parameter name.
-
-
-
Method Detail
-
removeEntry
public boolean removeEntry(String name)
Removes a schema entry from this Schema- Parameters:
name
- the name of the parameter- Returns:
- whether or not the removal was successful
-
addEntry
public void addEntry(String name, Class type, Object defValue)
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
public void addConstraint(String name, List constrainingList)
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
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 parmaeterconstrainingRange
- a range of the possible values for the named parameter
-
getDetails
public ParameterSchema getDetails(String paramName)
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
public Iterable<String> 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
public boolean validate(String paramName, Object obj)
Validates the specified object against the type info contained for the parameter name.
-
contains
public boolean contains(String paramName)
Returns true if this schema contains contains the specified parameter name, otherwise false.
-
-