org.opensha.commons.param.impl
Class RegionParameter

java.lang.Object
  extended by org.opensha.commons.param.AbstractParameter<Region>
      extended by org.opensha.commons.param.impl.RegionParameter
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Parameter<?>>, Named, XMLSaveable, Parameter<Region>

public class RegionParameter
extends AbstractParameter<Region>

Title: LocationParameter

Description: Make a Location Parameter

Version:
1.0
Author:
: Nitin Gupta and Vipin Gupta
See Also:
Serialized Form

Field Summary
protected static java.lang.String C
          Class name for debugging.
protected static boolean D
          If true print out debug statements.
static java.lang.String MAX_LATITUDE
           
static java.lang.String MAX_LONGITUDE
           
protected  Parameter maxLatParam
           
protected  Parameter maxLonParam
           
static java.lang.String MIN_LATITUDE
           
static java.lang.String MIN_LONGITUDE
           
protected  Parameter minLatParam
           
protected  Parameter minLonParam
           
protected static java.lang.String PARAM_TYPE
           
protected  ParameterListParameter regionParameterListParameter
           
 
Fields inherited from class org.opensha.commons.param.AbstractParameter
constraint, defaultValue, editable, independentParameters, info, metadataString, name, units, value, XML_COMPLEX_VAL_EL_NAME, XML_GROUP_METADATA_NAME, XML_METADATA_NAME, XML_NULL_VALUE
 
Fields inherited from interface org.opensha.commons.param.Parameter
XML_INDEPENDENT_PARAMS_NAME
 
Constructor Summary
RegionParameter(java.lang.String name)
          No constraints specified for this parameter.
RegionParameter(java.lang.String name, Region value)
          Creates a location parameter with constraint being list of locations and current value of the parameter from these list of locations.
RegionParameter(java.lang.String name, java.lang.String units, double minLat, double maxLat, double minLon, double maxLon)
           
 
Method Summary
 java.lang.Object clone()
          Returns a copy so you can't edit or damage the origial.
 java.util.List<Location> getAllowedLocations()
          Returns a clone of the allowed strings of the constraint.
 AbstractParameterEditorOld getEditor()
          Returns the Editor for this Parameter.
 double getMaxLatitude()
          Returns the latitude of selected location
 double getMaxLongitude()
          Returns the latitude of selected location
 java.lang.String getMetadataString()
          This overrides the getmetadataString() method because the value here does not have an ASCII representation (and we need to know the values of the independent parameter instead).
 double getMinLatitude()
          Returns the latitude of selected location
 double getMinLongitude()
          Returns the latitude of selected location
 Parameter getRegionParameter()
          returns location parameter.
 java.lang.String getType()
          Returns the name of the parameter class
 void setConstraint(ParameterConstraint constraint)
          Sets the constraint reference if it is a StringConstraint and the parameter is currently editable, else throws an exception.
 boolean setIndividualParamValueFromXML(Element el)
          This should set the value of this individual parameter.
 void setupParams(Region value)
           
 void setValue(Region reg)
          Sets the location parameter with updated location value
 
Methods inherited from class org.opensha.commons.param.AbstractParameter
addIndependentParameter, addParameterChangeFailListener, addParameterChangeListener, checkEditable, compareTo, containsIndependentParameter, equals, firePropertyChange, firePropertyChangeFailed, getConstraint, getConstraintName, getDefaultValue, getDependentParamMetadataString, getIndependentParameter, getIndependentParameterList, getIndependentParametersKey, getInfo, getName, getNumIndependentParameters, getUnits, getValue, isAllowed, isEditable, isNullAllowed, removeIndependentParameter, removeParameterChangeFailListener, removeParameterChangeListener, setDefaultValue, setDependentParamMetadataString, setIndependentParameters, setIndepParamsFromXML, setInfo, setName, setNonEditable, setUnits, setValueAsDefault, setValueFromXMLMetadata, toXMLMetadata, toXMLMetadata, unableToSetValue, valueToXML
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C

protected static final java.lang.String C
Class name for debugging.

See Also:
Constant Field Values

D

protected static final boolean D
If true print out debug statements.

See Also:
Constant Field Values

PARAM_TYPE

protected static final java.lang.String PARAM_TYPE
See Also:
Constant Field Values

regionParameterListParameter

protected ParameterListParameter regionParameterListParameter

MIN_LONGITUDE

public static final java.lang.String MIN_LONGITUDE
See Also:
Constant Field Values

MAX_LONGITUDE

public static final java.lang.String MAX_LONGITUDE
See Also:
Constant Field Values

MIN_LATITUDE

public static final java.lang.String MIN_LATITUDE
See Also:
Constant Field Values

MAX_LATITUDE

public static final java.lang.String MAX_LATITUDE
See Also:
Constant Field Values

minLatParam

protected Parameter minLatParam

maxLatParam

protected Parameter maxLatParam

minLonParam

protected Parameter minLonParam

maxLonParam

protected Parameter maxLonParam
Constructor Detail

RegionParameter

public RegionParameter(java.lang.String name)
No constraints specified for this parameter. Sets the name of this parameter.

Parameters:
name - Name of the parameter

RegionParameter

public RegionParameter(java.lang.String name,
                       Region value)
                throws ConstraintException
Creates a location parameter with constraint being list of locations and current value of the parameter from these list of locations.

Parameters:
name - String Name of the location parameter
locationList - ArrayList : List of allowed locations
value - Location : Parameter value, should be one of the allowed location
Throws:
ConstraintException

RegionParameter

public RegionParameter(java.lang.String name,
                       java.lang.String units,
                       double minLat,
                       double maxLat,
                       double minLon,
                       double maxLon)
                throws ConstraintException
Throws:
ConstraintException
Method Detail

setupParams

public void setupParams(Region value)

getRegionParameter

public Parameter getRegionParameter()
returns location parameter.

Returns:
ParameterAPI : Returns the instance ParameterListParameter that holds the parameters constituting the location, if location parameter specifies no constraint. But if constraint is not null, then it returns the instance of LocationParameter with constraints, similar to String parameter with constraints.

setConstraint

public void setConstraint(ParameterConstraint constraint)
                   throws ParameterException,
                          EditableException
Sets the constraint reference if it is a StringConstraint and the parameter is currently editable, else throws an exception.

Specified by:
setConstraint in interface Parameter<Region>
Overrides:
setConstraint in class AbstractParameter<Region>
Parameters:
constraint - to set
Throws:
ParameterException
EditableException

setValue

public void setValue(Region reg)
Sets the location parameter with updated location value

Specified by:
setValue in interface Parameter<Region>
Overrides:
setValue in class AbstractParameter<Region>
Parameters:
loc - Location

getMinLatitude

public double getMinLatitude()
Returns the latitude of selected location

Returns:
double

getMaxLatitude

public double getMaxLatitude()
Returns the latitude of selected location

Returns:
double

getMinLongitude

public double getMinLongitude()
Returns the latitude of selected location

Returns:
double

getMaxLongitude

public double getMaxLongitude()
Returns the latitude of selected location

Returns:
double

getAllowedLocations

public java.util.List<Location> getAllowedLocations()
Returns a clone of the allowed strings of the constraint. Useful for presenting in a picklist

Returns:
The allowed Locations list

clone

public java.lang.Object clone()
Returns a copy so you can't edit or damage the origial.

Specified by:
clone in interface Parameter<Region>
Specified by:
clone in class AbstractParameter<Region>
Returns:
Exact copy of this object's state

getType

public java.lang.String getType()
Returns the name of the parameter class

Specified by:
getType in interface Parameter<Region>
Overrides:
getType in class AbstractParameter<Region>

getMetadataString

public java.lang.String getMetadataString()
This overrides the getmetadataString() method because the value here does not have an ASCII representation (and we need to know the values of the independent parameter instead).

Specified by:
getMetadataString in interface Parameter<Region>
Overrides:
getMetadataString in class AbstractParameter<Region>
Returns:
String

setIndividualParamValueFromXML

public boolean setIndividualParamValueFromXML(Element el)
Description copied from class: AbstractParameter
This should set the value of this individual parameter. The values of the independent parameters will be set by the final setValueFromXMLMetadata method

Specified by:
setIndividualParamValueFromXML in class AbstractParameter<Region>
Returns:

getEditor

public AbstractParameterEditorOld getEditor()
Description copied from interface: Parameter
Returns the Editor for this Parameter. It is recommended that editors be lazily instantiated.

Returns:
the Editor