org.opensha.commons.param.impl
Class ArbitrarilyDiscretizedFuncParameter

java.lang.Object
  extended by org.opensha.commons.param.AbstractParameter<ArbitrarilyDiscretizedFunc>
      extended by org.opensha.commons.param.impl.ArbitrarilyDiscretizedFuncParameter
All Implemented Interfaces:
Serializable, Comparable<Parameter<?>>, Named, XMLSaveable, Parameter<ArbitrarilyDiscretizedFunc>
Direct Known Subclasses:
MagDistCutoffParam

public class ArbitrarilyDiscretizedFuncParameter
extends AbstractParameter<ArbitrarilyDiscretizedFunc>
implements Serializable

Title: ArbitrarilyDiscretizedFuncParameter.java

Description: Makes a textfield to enter X and Y values. This class has 2 methods for setting the units : 1. setUnits() : This method sets the units for Y values 2. setXUnits(): This method sets the units for X values. Similarly, we have 2 different methods for getting the units.

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

Field Summary
protected static String C
          Class name for debugging.
protected static boolean D
          If true print out debug statements.
protected static String PARAM_TYPE
           
 
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
ArbitrarilyDiscretizedFuncParameter(String name, ArbitrarilyDiscretizedFunc discretizedFunc)
          No constraints specified, all values allowed.
 
Method Summary
 Object clone()
          Returns a copy so you can't edit or damage the origial.
 boolean equals(Object obj)
          Compares value to see if equal.
 ParameterEditor<ArbitrarilyDiscretizedFunc> getEditor()
          Returns the Editor for this Parameter.
 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).
 ArbitrarilyDiscretizedFunc getParameter()
           
 String getType()
          Returns the name of the parameter class
 String getXUnits()
          Returns the units of X values for this parameter.
 boolean isAllowed(ArbitrarilyDiscretizedFunc obj)
          Compares the values to if this is less than, equal to, or greater than the comparing objects.
 boolean setIndividualParamValueFromXML(Element el)
          This should set the value of this individual parameter.
 void setXUnits(String units)
          Sets the units for X Values.
 
Methods inherited from class org.opensha.commons.param.AbstractParameter
addIndependentParameter, addParameterChangeFailListener, addParameterChangeListener, checkEditable, compareTo, containsIndependentParameter, firePropertyChange, firePropertyChangeFailed, getConstraint, getConstraintName, getDefaultValue, getDependentParamMetadataString, getIndependentParameter, getIndependentParameterList, getIndependentParametersKey, getInfo, getName, getNumIndependentParameters, getUnits, getValue, isEditable, isNullAllowed, removeIndependentParameter, removeParameterChangeFailListener, removeParameterChangeListener, setConstraint, setDefaultValue, setDependentParamMetadataString, setIndependentParameters, setIndepParamsFromXML, setInfo, setName, setNonEditable, setUnits, setValue, 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 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 String PARAM_TYPE
See Also:
Constant Field Values
Constructor Detail

ArbitrarilyDiscretizedFuncParameter

public ArbitrarilyDiscretizedFuncParameter(String name,
                                           ArbitrarilyDiscretizedFunc discretizedFunc)
No constraints specified, all values allowed. Sets the name and value.

Parameters:
name - Name of the parameter
discretizedFunc - DiscretizedFunc object
Method Detail

setXUnits

public void setXUnits(String units)
               throws EditableException
Sets the units for X Values. To set the units for Y values, use the setUnits() method

Throws:
EditableException

getXUnits

public String getXUnits()
Returns the units of X values for this parameter. To get the units for Y values, use getUnits() method represented as a String.


isAllowed

public boolean isAllowed(ArbitrarilyDiscretizedFunc obj)
Compares the values to if this is less than, equal to, or greater than the comparing objects.

Specified by:
isAllowed in interface Parameter<ArbitrarilyDiscretizedFunc>
Overrides:
isAllowed in class AbstractParameter<ArbitrarilyDiscretizedFunc>
Parameters:
obj - The object to compare this to
Returns:
-1 if this value < obj value, 0 if equal, +1 if this value > obj value
Throws:
ClassCastException - Is thrown if the comparing object is not a ParameterListParameter.

equals

public boolean equals(Object obj)
Compares value to see if equal.

Specified by:
equals in interface Parameter<ArbitrarilyDiscretizedFunc>
Overrides:
equals in class AbstractParameter<ArbitrarilyDiscretizedFunc>
Parameters:
obj - The object to compare this to
Returns:
True if the values are identical
Throws:
ClassCastException - Is thrown if the comparing object is not a LocationListParameter.

clone

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

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

getParameter

public ArbitrarilyDiscretizedFunc getParameter()
Returns:
the ArbitrarilyDiscretizedFunc contained in this parameter

getType

public String getType()
Returns the name of the parameter class

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

getMetadataString

public 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<ArbitrarilyDiscretizedFunc>
Overrides:
getMetadataString in class AbstractParameter<ArbitrarilyDiscretizedFunc>
Returns:
Sstring

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<ArbitrarilyDiscretizedFunc>
Returns:

getEditor

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

Specified by:
getEditor in interface Parameter<ArbitrarilyDiscretizedFunc>
Returns:
the Editor