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:
java.io.Serializable, java.lang.Comparable, Named, XMLSaveable, Parameter

public class MagFreqDistParameter
extends AbstractParameter
implements java.io.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 java.lang.String ARB_INCR_PARAM_NAME
           
static java.lang.String BVALUE_INFO
           
protected static java.lang.String C
          Class name for debugging.
protected static boolean D
          If true print out debug statements.
static java.lang.String DISTRIBUTION_NAME
          the string for the distribution choice parameter
static java.lang.String FIX
           
static java.lang.String FIX_INFO
           
static java.lang.String FIX_RATE
           
static java.lang.String FIX_TO_CUM_RATE
           
static java.lang.String FIX_TOT_MO_RATE
           
static java.lang.String GR_BVALUE
           
static java.lang.String GR_MAG_LOWER
           
static java.lang.String GR_MAG_LOWER_INFO
           
static java.lang.String GR_MAG_UPPER
           
static java.lang.String GR_MAG_UPPER_INFO
           
static java.lang.String MAG
           
static java.lang.String MAG_AND_MO_RATE
           
static java.lang.String MAX
           
static java.lang.String MAX_INFO
           
static java.lang.String MEAN
          Gaussian Magnitude Frequency Distribution Parameter string list constant
static java.lang.String MIN
          Name and Info strings of params needed by all distributions
static java.lang.String MIN_INFO
           
static java.lang.String MO_RATE
           
static java.lang.String MO_RATE_UNITS
           
static java.lang.String NONE
           
static java.lang.String NUM
           
static java.lang.String NUM_INFO
           
static java.lang.String RATE
          Single Magnitude Frequency Distribution Parameter names
static java.lang.String RATE_AND_MAG
           
static java.lang.String RATE_AND_MO_RATE
           
static java.lang.String RATE_UNITS
           
static java.lang.String SET_ALL_PARAMS_BUT
           
static java.lang.String SINGLE_PARAMS_TO_SET
           
static java.lang.String STD_DEV
           
static java.lang.String TAPERED_GR_CORNER_MAG
           
static java.lang.String TAPERED_GR_CORNER_MAG_INFO
           
static java.lang.String TOT_CUM_RATE
           
static java.lang.String TOT_MO_RATE
          Name, units, and info strings for parameters needed by more than one distribution (shared)
static java.lang.String TRUNCATE_NUM_OF_STD_DEV
           
static java.lang.String TRUNCATE_ON_BOTH_SIDES
           
static java.lang.String TRUNCATE_UPPER_ONLY
           
static java.lang.String TRUNCATION_REQ
           
static java.lang.String YC_DELTA_MAG_CHAR
          Young and Coppersmith, 1985 Char dist.
static java.lang.String YC_DELTA_MAG_CHAR_INFO
           
static java.lang.String YC_DELTA_MAG_PRIME
           
static java.lang.String YC_DELTA_MAG_PRIME_INFO
           
static java.lang.String YC_MAG_PRIME
           
static java.lang.String YC_MAG_PRIME_INFO
           
static java.lang.String YC_TOT_CHAR_RATE
           
static java.lang.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(java.lang.String name)
          No constraints specified, all MagFreqDists allowed.
MagFreqDistParameter(java.lang.String name, java.util.ArrayList allowedMagDists)
          Sets the name, defines the constraints as ArrayList of String values.
MagFreqDistParameter(java.lang.String name, java.util.ArrayList allowedMagDists, IncrementalMagFreqDist value)
          Sets the name, and value.
MagFreqDistParameter(java.lang.String name, IncrementalMagFreqDist value)
          No constraints specified, all values allowed.
MagFreqDistParameter(java.lang.String name, MagFreqDistConstraint constraint)
          Sets the name and Constraints object.
MagFreqDistParameter(java.lang.String name, MagFreqDistConstraint constraint, IncrementalMagFreqDist value)
          Sets the name, value and constraint.
 
Method Summary
 java.lang.Object clone()
          Returns a copy so you can't edit or damage the origial.
 int compareTo(java.lang.Object obj)
          Compares the values to if this is less than, equal to, or greater than the comparing objects.
 boolean equals(java.lang.Object obj)
          Compares value to see if equal.
 ParameterList getAdjustableParams()
           
 java.util.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()
           
 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).
 StringConstraint getSingleDistFixOptions()
          Return the FIX and SET_ALL_PARAMS_BUT constraints for each dist
 StringConstraint getTapGRSetAllButOptions()
           
 java.lang.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, java.lang.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 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

DISTRIBUTION_NAME

public static final java.lang.String DISTRIBUTION_NAME
the string for the distribution choice parameter

See Also:
Constant Field Values

MIN

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


MIN_INFO

public static final java.lang.String MIN_INFO

MAX

public static final java.lang.String MAX

MAX_INFO

public static final java.lang.String MAX_INFO

NUM

public static final java.lang.String NUM

NUM_INFO

public static final java.lang.String NUM_INFO

TOT_MO_RATE

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


MO_RATE_UNITS

public static final java.lang.String MO_RATE_UNITS

TOT_CUM_RATE

public static final java.lang.String TOT_CUM_RATE

RATE_UNITS

public static final java.lang.String RATE_UNITS

GR_MAG_UPPER

public static final java.lang.String GR_MAG_UPPER

GR_MAG_UPPER_INFO

public static final java.lang.String GR_MAG_UPPER_INFO

GR_MAG_LOWER

public static final java.lang.String GR_MAG_LOWER

GR_MAG_LOWER_INFO

public static final java.lang.String GR_MAG_LOWER_INFO

GR_BVALUE

public static final java.lang.String GR_BVALUE

BVALUE_INFO

public static final java.lang.String BVALUE_INFO

SET_ALL_PARAMS_BUT

public static final java.lang.String SET_ALL_PARAMS_BUT

FIX

public static final java.lang.String FIX

FIX_INFO

public static final java.lang.String FIX_INFO

FIX_TOT_MO_RATE

public static final java.lang.String FIX_TOT_MO_RATE

FIX_TO_CUM_RATE

public static final java.lang.String FIX_TO_CUM_RATE

FIX_RATE

public static final java.lang.String FIX_RATE

RATE

public static final java.lang.String RATE
Single Magnitude Frequency Distribution Parameter names


MAG

public static final java.lang.String MAG

MO_RATE

public static final java.lang.String MO_RATE

SINGLE_PARAMS_TO_SET

public static final java.lang.String SINGLE_PARAMS_TO_SET

RATE_AND_MAG

public static final java.lang.String RATE_AND_MAG

MAG_AND_MO_RATE

public static final java.lang.String MAG_AND_MO_RATE

RATE_AND_MO_RATE

public static final java.lang.String RATE_AND_MO_RATE

YC_DELTA_MAG_CHAR

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


YC_DELTA_MAG_CHAR_INFO

public static final java.lang.String YC_DELTA_MAG_CHAR_INFO

YC_MAG_PRIME

public static final java.lang.String YC_MAG_PRIME

YC_MAG_PRIME_INFO

public static final java.lang.String YC_MAG_PRIME_INFO

YC_DELTA_MAG_PRIME

public static final java.lang.String YC_DELTA_MAG_PRIME

YC_DELTA_MAG_PRIME_INFO

public static final java.lang.String YC_DELTA_MAG_PRIME_INFO

YC_TOT_CHAR_RATE

public static final java.lang.String YC_TOT_CHAR_RATE

YC_TOT_CHAR_RATE_INFO

public static final java.lang.String YC_TOT_CHAR_RATE_INFO

MEAN

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


STD_DEV

public static final java.lang.String STD_DEV

TRUNCATION_REQ

public static final java.lang.String TRUNCATION_REQ

TRUNCATE_UPPER_ONLY

public static final java.lang.String TRUNCATE_UPPER_ONLY

TRUNCATE_ON_BOTH_SIDES

public static final java.lang.String TRUNCATE_ON_BOTH_SIDES

TRUNCATE_NUM_OF_STD_DEV

public static final java.lang.String TRUNCATE_NUM_OF_STD_DEV

NONE

public static final java.lang.String NONE

TAPERED_GR_CORNER_MAG

public static final java.lang.String TAPERED_GR_CORNER_MAG

TAPERED_GR_CORNER_MAG_INFO

public static final java.lang.String TAPERED_GR_CORNER_MAG_INFO

ARB_INCR_PARAM_NAME

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

MagFreqDistParameter

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

Parameters:
name - Name of the parameter

MagFreqDistParameter

public MagFreqDistParameter(java.lang.String name,
                            java.util.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(java.lang.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(java.lang.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(java.lang.String name,
                            java.util.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(java.lang.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 java.util.ArrayList getAllowedMagDists()
Gets array list of allowed MagFreqDists.

Returns:
ArrayList of allowed Mag Dists

compareTo

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

Specified by:
compareTo in interface java.lang.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:
java.lang.ClassCastException - Is thrown if the comparing object is not a DoubleParameter, or DoubleDiscreteParameter.
java.lang.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(java.lang.Object obj)
               throws java.lang.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:
java.lang.ClassCastException - Is thrown if the comparing object is not a DoubleParameter, or DoubleDiscreteParameter.
java.lang.UnsupportedOperationException

clone

public java.lang.Object clone()
                       throws java.lang.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:
java.lang.UnsupportedOperationException

getType

public java.lang.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,
                                      java.lang.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 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
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