org.opensha.sha.param
Class MagFreqDistParameter

java.lang.Object
  extended by org.opensha.commons.param.AbstractParameter
      extended by org.opensha.sha.param.MagFreqDistParameter
All Implemented Interfaces:
Serializable, Comparable, Named, XMLSaveable, Parameter

public class MagFreqDistParameter
extends AbstractParameter
implements Serializable

Title: MagFreqDistParameter

Description: Generic Parameter that contains a IncremnetalMagFreqDist and optionally a list of allowed values stored in a constraint object. If no constraint object is present then all MagFreDists are permitted

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

Field Summary
static String ARB_INCR_PARAM_NAME
           
static String BVALUE_INFO
           
protected static String C
          Class name for debugging.
protected static boolean D
          If true print out debug statements.
static String DISTRIBUTION_NAME
          the string for the distribution choice parameter
static String FIX
           
static String FIX_INFO
           
static String FIX_RATE
           
static String FIX_TO_CUM_RATE
           
static String FIX_TOT_MO_RATE
           
static String GR_BVALUE
           
static String GR_MAG_LOWER
           
static String GR_MAG_LOWER_INFO
           
static String GR_MAG_UPPER
           
static String GR_MAG_UPPER_INFO
           
static String MAG
           
static String MAG_AND_MO_RATE
           
static String MAX
           
static String MAX_INFO
           
static String MEAN
          Gaussian Magnitude Frequency Distribution Parameter string list constant
static String MIN
          Name and Info strings of params needed by all distributions
static String MIN_INFO
           
static String MO_RATE
           
static String MO_RATE_UNITS
           
static String NONE
           
static String NUM
           
static String NUM_INFO
           
static String RATE
          Single Magnitude Frequency Distribution Parameter names
static String RATE_AND_MAG
           
static String RATE_AND_MO_RATE
           
static String RATE_UNITS
           
static String SET_ALL_PARAMS_BUT
           
static String SINGLE_PARAMS_TO_SET
           
static String STD_DEV
           
static String TAPERED_GR_CORNER_MAG
           
static String TAPERED_GR_CORNER_MAG_INFO
           
static String TOT_CUM_RATE
           
static String TOT_MO_RATE
          Name, units, and info strings for parameters needed by more than one distribution (shared)
static String TRUNCATE_NUM_OF_STD_DEV
           
static String TRUNCATE_ON_BOTH_SIDES
           
static String TRUNCATE_UPPER_ONLY
           
static String TRUNCATION_REQ
           
static String YC_DELTA_MAG_CHAR
          Young and Coppersmith, 1985 Char dist.
static String YC_DELTA_MAG_CHAR_INFO
           
static String YC_DELTA_MAG_PRIME
           
static String YC_DELTA_MAG_PRIME_INFO
           
static String YC_MAG_PRIME
           
static String YC_MAG_PRIME_INFO
           
static String YC_TOT_CHAR_RATE
           
static String YC_TOT_CHAR_RATE_INFO
           
 
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
MagFreqDistParameter(String name)
          No constraints specified, all MagFreqDists allowed.
MagFreqDistParameter(String name, ArrayList allowedMagDists)
          Sets the name, defines the constraints as ArrayList of String values.
MagFreqDistParameter(String name, ArrayList allowedMagDists, IncrementalMagFreqDist value)
          Sets the name, and value.
MagFreqDistParameter(String name, IncrementalMagFreqDist value)
          No constraints specified, all values allowed.
MagFreqDistParameter(String name, MagFreqDistConstraint constraint)
          Sets the name and Constraints object.
MagFreqDistParameter(String name, MagFreqDistConstraint constraint, IncrementalMagFreqDist value)
          Sets the name, value and constraint.
 
Method Summary
 Object clone()
          Returns a copy so you can't edit or damage the origial.
 int compareTo(Object obj)
          Compares the values to if this is less than, equal to, or greater than the comparing objects.
 boolean equals(Object obj)
          Compares value to see if equal.
 ParameterList getAdjustableParams()
           
 ArrayList getAllowedMagDists()
          Gets array list of allowed MagFreqDists.
 EvenlyDiscretizedFuncParameter getArbIncrementalMagFreqDist()
          Returns the EvenlyDiscretizedFuncParameter
 AbstractParameterEditorOld getEditor()
          Returns the Editor for this Parameter.
 StringConstraint getGaussianDistSetAllButOptions()
           
 StringConstraint getGRFixOptions()
           
 StringConstraint getGRSetAllButOptions()
           
 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).
 StringConstraint getSingleDistFixOptions()
          Return the FIX and SET_ALL_PARAMS_BUT constraints for each dist
 StringConstraint getTapGRSetAllButOptions()
           
 String getType()
          Returns the type(full path with the classname) of the MagDist Classes
 StringConstraint getYCSetAllButOptions()
           
 boolean isAllowed(IncrementalMagFreqDist d)
          Uses the constraint object to determine if the new value being set is allowed.
 void setConstraint(ParameterConstraint constraint)
          Sets the constraint if it is a StringConstraint and the parameter is currently editable.
 boolean setIndividualParamValueFromXML(Element el)
          This should set the value of this individual parameter.
 void setMagDist()
          set the IncrementalMagFreqDist object based on parameters given
 void setMagDist(ParameterList newParamList)
          Updates the MagFreqDistParams with the new parameters.
 void setMagDistAsSummedMagDist(SummedMagFreqDist magDist, String metadata)
          Sets the MagDist as the Summed MagDist.
 void setSummedDistPlotted(boolean sumDistPlotted)
          Sets the Summed Dist plotted to be false or true based on
 void setValue(IncrementalMagFreqDist value)
          Set's the parameter's value.
 
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, isAllowed, isEditable, isNullAllowed, removeIndependentParameter, removeParameterChangeFailListener, removeParameterChangeListener, 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

DISTRIBUTION_NAME

public static final String DISTRIBUTION_NAME
the string for the distribution choice parameter

See Also:
Constant Field Values

MIN

public static final String MIN
Name and Info strings of params needed by all distributions


MIN_INFO

public static final String MIN_INFO

MAX

public static final String MAX

MAX_INFO

public static final String MAX_INFO

NUM

public static final String NUM

NUM_INFO

public static final String NUM_INFO

TOT_MO_RATE

public static final String TOT_MO_RATE
Name, units, and info strings for parameters needed by more than one distribution (shared)


MO_RATE_UNITS

public static final String MO_RATE_UNITS

TOT_CUM_RATE

public static final String TOT_CUM_RATE

RATE_UNITS

public static final String RATE_UNITS

GR_MAG_UPPER

public static final String GR_MAG_UPPER

GR_MAG_UPPER_INFO

public static final String GR_MAG_UPPER_INFO

GR_MAG_LOWER

public static final String GR_MAG_LOWER

GR_MAG_LOWER_INFO

public static final String GR_MAG_LOWER_INFO

GR_BVALUE

public static final String GR_BVALUE

BVALUE_INFO

public static final String BVALUE_INFO

SET_ALL_PARAMS_BUT

public static final String SET_ALL_PARAMS_BUT

FIX

public static final String FIX

FIX_INFO

public static final String FIX_INFO

FIX_TOT_MO_RATE

public static final String FIX_TOT_MO_RATE

FIX_TO_CUM_RATE

public static final String FIX_TO_CUM_RATE

FIX_RATE

public static final String FIX_RATE

RATE

public static final String RATE
Single Magnitude Frequency Distribution Parameter names


MAG

public static final String MAG

MO_RATE

public static final String MO_RATE

SINGLE_PARAMS_TO_SET

public static final String SINGLE_PARAMS_TO_SET

RATE_AND_MAG

public static final String RATE_AND_MAG

MAG_AND_MO_RATE

public static final String MAG_AND_MO_RATE

RATE_AND_MO_RATE

public static final String RATE_AND_MO_RATE

YC_DELTA_MAG_CHAR

public static final String YC_DELTA_MAG_CHAR
Young and Coppersmith, 1985 Char dist. parameter names


YC_DELTA_MAG_CHAR_INFO

public static final String YC_DELTA_MAG_CHAR_INFO

YC_MAG_PRIME

public static final String YC_MAG_PRIME

YC_MAG_PRIME_INFO

public static final String YC_MAG_PRIME_INFO

YC_DELTA_MAG_PRIME

public static final String YC_DELTA_MAG_PRIME

YC_DELTA_MAG_PRIME_INFO

public static final String YC_DELTA_MAG_PRIME_INFO

YC_TOT_CHAR_RATE

public static final String YC_TOT_CHAR_RATE

YC_TOT_CHAR_RATE_INFO

public static final String YC_TOT_CHAR_RATE_INFO

MEAN

public static final String MEAN
Gaussian Magnitude Frequency Distribution Parameter string list constant


STD_DEV

public static final String STD_DEV

TRUNCATION_REQ

public static final String TRUNCATION_REQ

TRUNCATE_UPPER_ONLY

public static final String TRUNCATE_UPPER_ONLY

TRUNCATE_ON_BOTH_SIDES

public static final String TRUNCATE_ON_BOTH_SIDES

TRUNCATE_NUM_OF_STD_DEV

public static final String TRUNCATE_NUM_OF_STD_DEV

NONE

public static final String NONE

TAPERED_GR_CORNER_MAG

public static final String TAPERED_GR_CORNER_MAG

TAPERED_GR_CORNER_MAG_INFO

public static final String TAPERED_GR_CORNER_MAG_INFO

ARB_INCR_PARAM_NAME

public static final String ARB_INCR_PARAM_NAME
See Also:
Constant Field Values
Constructor Detail

MagFreqDistParameter

public MagFreqDistParameter(String name)
No constraints specified, all MagFreqDists allowed. Sets the name of this parameter.

Parameters:
name - Name of the parameter

MagFreqDistParameter

public MagFreqDistParameter(String name,
                            ArrayList allowedMagDists)
                     throws ConstraintException
Sets the name, defines the constraints as ArrayList of String values. Creates the constraint object from these values.

Parameters:
name - Name of the parameter
allowedMagDists - ArrayList of allowed values
Throws:
ConstraintException - thrown if the value is not allowed
ConstraintException - Is thrown if the value is not allowed

MagFreqDistParameter

public MagFreqDistParameter(String name,
                            MagFreqDistConstraint constraint)
                     throws ConstraintException
Sets the name and Constraints object.

Parameters:
name - Name of the parameter
constraint - defines vector of allowed values
Throws:
ConstraintException - thrown if the value is not allowed
ConstraintException - Is thrown if the value is not allowed

MagFreqDistParameter

public MagFreqDistParameter(String name,
                            IncrementalMagFreqDist value)
No constraints specified, all values allowed. Sets the name and value.

Parameters:
name - Name of the parameter
value - IncrementalMagFreqDist object

MagFreqDistParameter

public MagFreqDistParameter(String name,
                            ArrayList allowedMagDists,
                            IncrementalMagFreqDist value)
                     throws ConstraintException
Sets the name, and value. Also defines the min and max from which the constraint is constructed.

Parameters:
name - Name of the parameter
value - IncrementalMagFreqDist object of this parameter
allowedMagDists - ArrayList of allowed Mag Dists
Throws:
ConstraintException - thrown if the value is not allowed
ConstraintException - Is thrown if the value is not allowed

MagFreqDistParameter

public MagFreqDistParameter(String name,
                            MagFreqDistConstraint constraint,
                            IncrementalMagFreqDist value)
                     throws ConstraintException
Sets the name, value and constraint. The value is checked if it is within constraints.

Parameters:
name - Name of the parameter
constraint - vector of allowed Mag Dists
value - IncrementalMagFreqDist object
Throws:
ConstraintException - thrown if the value is not allowed
ConstraintException - Is thrown if the value is not allowed
Method Detail

setConstraint

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

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

getAllowedMagDists

public ArrayList getAllowedMagDists()
Gets array list of allowed MagFreqDists.

Returns:
ArrayList of allowed Mag Dists

compareTo

public int compareTo(Object obj)
              throws UnsupportedOperationException
Compares the values to if this is less than, equal to, or greater than the comparing objects.

Specified by:
compareTo in interface Comparable
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 DoubleParameter, or DoubleDiscreteParameter.
UnsupportedOperationException

setValue

public void setValue(IncrementalMagFreqDist value)
              throws ConstraintException,
                     ParameterException
Set's the parameter's value.

Parameters:
value - The new value for this Parameter
Throws:
ParameterException - Thrown if the object is currenlty not editable
ConstraintException - Thrown if the object value is not allowed

isAllowed

public boolean isAllowed(IncrementalMagFreqDist d)
Uses the constraint object to determine if the new value being set is allowed. If no Constraints are present all values are allowed. This function is now available to all subclasses, since any type of constraint object follows the same api.

Parameters:
obj - Object to check if allowed via constraints
Returns:
True if the value is allowed

equals

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

Specified by:
equals in interface Parameter
Overrides:
equals in class AbstractParameter
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 DoubleParameter, or DoubleDiscreteParameter.
UnsupportedOperationException

clone

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

Specified by:
clone in interface Parameter
Specified by:
clone in class AbstractParameter
Returns:
Exact copy of this object's state
Throws:
UnsupportedOperationException

getType

public String getType()
Returns the type(full path with the classname) of the MagDist Classes

Specified by:
getType in interface Parameter
Overrides:
getType in class AbstractParameter

getAdjustableParams

public ParameterList getAdjustableParams()
Returns:
the adjustable parameterlist

getArbIncrementalMagFreqDist

public EvenlyDiscretizedFuncParameter getArbIncrementalMagFreqDist()
Returns the EvenlyDiscretizedFuncParameter

Returns:
EvenlyDiscretizedFuncParameter

setMagDist

public void setMagDist(ParameterList newParamList)
Updates the MagFreqDistParams with the new parameters.

Parameters:
newParamList - Cloned Parameterlist

setMagDistAsSummedMagDist

public void setMagDistAsSummedMagDist(SummedMagFreqDist magDist,
                                      String metadata)
Sets the MagDist as the Summed MagDist.

Parameters:
magDist - SummedMagFreqDist
metadata - String

setSummedDistPlotted

public void setSummedDistPlotted(boolean sumDistPlotted)
Sets the Summed Dist plotted to be false or true based on

Parameters:
sumDistPlotted - boolean

setMagDist

public void setMagDist()
set the IncrementalMagFreqDist object based on parameters given


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

getSingleDistFixOptions

public StringConstraint getSingleDistFixOptions()
Return the FIX and SET_ALL_PARAMS_BUT constraints for each dist

Returns:

getGRSetAllButOptions

public StringConstraint getGRSetAllButOptions()

getGRFixOptions

public StringConstraint getGRFixOptions()

getYCSetAllButOptions

public StringConstraint getYCSetAllButOptions()

getGaussianDistSetAllButOptions

public StringConstraint getGaussianDistSetAllButOptions()

getTapGRSetAllButOptions

public StringConstraint getTapGRSetAllButOptions()

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

getEditor

public AbstractParameterEditorOld 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
Returns:
the Editor