Package repast.simphony.parameter
Class DefaultParameterSchema
java.lang.Object
repast.simphony.parameter.DefaultParameterSchema
- All Implemented Interfaces:
ParameterSchema
Default implementation of ParameterSchema.
- Author:
- Nick Collier
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultParameterSchema(String name, Class type, Object defValue) DefaultParameterSchema(String name, Class type, Object defValue, List possibleValues) DefaultParameterSchema(String name, Class type, Object defValue, SteppedRange constrainingRange) -
Method Summary
Modifier and TypeMethodDescriptionfromString(String str) Creates an Object from the String representation.Gets the list of values that constrain this parameter.Gets the numeric range of values that constrain this parameter.Gets the string representation of the values or range that constrain this parameter This will return an empty string if the parameter is not constrained (by a list or range)Gets the StringConverter if any.Gets the default value of the parameter.getName()Gets the name of the parameter that this is the schema for.getType()Gets the type of the parameter.voidsetConstrainingList(List list) Sets the constraining list.voidsetConstrainingRange(SteppedRange range) Sets the constraining range.voidsetConvertor(StringConverter converter) Sets the converter for this schema.voidsetDefaultValue(Object obj) Sets the default value of this parameter.Converts the object into a String representation.booleanValidates the specified object against the type and optional constraint info for the parameter name.
-
Constructor Details
-
DefaultParameterSchema
-
DefaultParameterSchema
-
DefaultParameterSchema
-
DefaultParameterSchema
public DefaultParameterSchema(String name, Class type, Object defValue, SteppedRange constrainingRange)
-
-
Method Details
-
getConverter
Gets the StringConverter if any.- Specified by:
getConverterin interfaceParameterSchema- Returns:
- the StringConverter
-
setConvertor
Sets the converter for this schema.- Parameters:
converter- the converter
-
getName
Gets the name of the parameter that this is the schema for.- Specified by:
getNamein interfaceParameterSchema- Returns:
- the name of the parameter that this is the schema for.
-
getType
Gets the type of the parameter.- Specified by:
getTypein interfaceParameterSchema- Returns:
- the type of the parameter.
-
getDefaultValue
Gets the default value of the parameter.- Specified by:
getDefaultValuein interfaceParameterSchema- Returns:
- the default value of the parameter.
-
setDefaultValue
Sets the default value of this parameter.- Specified by:
setDefaultValuein interfaceParameterSchema- Parameters:
obj- the new default value
-
setConstrainingList
Sets the constraining list.- Parameters:
list- the constraining list
-
setConstrainingRange
Sets the constraining range.- Parameters:
range- the constraining range.
-
getConstrainingRange
Gets the numeric range of values that constrain this parameter. This will return null if the parameter is unconstrained by a numeric range.- Specified by:
getConstrainingRangein interfaceParameterSchema- Returns:
- the numeric range of values that constrain this parameter or null if the parameter is unconstrained by a range.
-
getConstrainingList
Gets the list of values that constrain this parameter. This will return null if the parameter is unconstrained by a list.- Specified by:
getConstrainingListin interfaceParameterSchema- Returns:
- the list of values that constrain this parameter or null if the parameter is unconstrained by a list of possible values.
-
getConstraintString
Gets the string representation of the values or range that constrain this parameter This will return an empty string if the parameter is not constrained (by a list or range)- Specified by:
getConstraintStringin interfaceParameterSchema- Returns:
- the string representation of the parameter constraints, if unconstrained an empty string
-
validate
Validates the specified object against the type and optional constraint info for the parameter name.- Specified by:
validatein interfaceParameterSchema- Parameters:
obj- the object to validate- Returns:
- true if the object is of a type valid for the parameter, otherwise false.
-
toString
Description copied from interface:ParameterSchemaConverts the object into a String representation.- Specified by:
toStringin interfaceParameterSchema- Parameters:
obj- the object to convert- Returns:
- the String representation.
-
fromString
Description copied from interface:ParameterSchemaCreates an Object from the String representation.- Specified by:
fromStringin interfaceParameterSchema- Parameters:
str- the String representation- Returns:
- the created Object
-