org.opensha.sha.param
Class SimpleFaultParameter

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

public class SimpleFaultParameter
extends AbstractParameter
implements ParameterChangeListener, Serializable

Title: SimpleFaultParameter

Description: This class acts as the intermediatory between SimpleFaultParameter and its editor.It extends the Dependent Parameter class so as to save the list of visible parameters. Most of the editor functionality has been embedded into this class because we want to make all the functionality available to the user if he does not want to use the GUI components. This is a more general parameter than the simple fault. Actually it creates an object for the EvenlyGriddedSurfaceEvenlyGriddedSurface

Version:
1.0
Author:
: Ned Field, 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.
static int DEFAULT_DIPS
           
static double DEFAULT_GRID_SPACING
           
static int DEFAULT_NUM_FAULT_TRACE
           
static String DEPTH_PARAM_NAME
           
static String DEPTH_TITLE
           
static String DIP_DIRECTION_PARAM_NAME
          DoubleParameter for Ave.
static String DIP_PARAM_NAME
           
static String DIP_TITLE
           
static String FAULT_NAME
           
static String FAULT_TYPE_TITLE
           
static String FRANKEL
           
static String GRID_SPACING
           
static String GRID_SPACING_UNITS
           
static String LAT_PARAM_NAME
           
static String LAT_TITLE
           
static int latlonCols
           
static String LON_PARAM_NAME
           
static String LON_TITLE
           
static String NUM_DIPS
           
static String NUMBER_OF_FAULT_TRACE
           
static String STIRLING
           
 
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
SimpleFaultParameter(String name)
          No constraints specified for this parameter.
SimpleFaultParameter(String name, AbstractEvenlyGriddedSurfaceWithSubsets surface)
          No constraints specified, all values allowed.
 
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.
 Parameter getDepthParam()
          returns ParameterListParameter
 ArrayList getDepthParamVals()
           
 Parameter getDipDirectionParam()
           
 Parameter getDipParam()
          returns ParameterListParameter
 ArrayList getDipParamVals()
           
 AbstractParameterEditorOld getEditor()
          Returns the Editor for this Parameter.
 String getFaultName()
           
 FaultTrace getFaultTrace()
           
 ParameterList getFaultTraceParamList()
           
 Parameter getFaultTypeParam()
           
 double getGridSpacing()
          Returns the grid spacing of the Fault Surface.
 Parameter getLatParam()
          returns ParameterListParameter
 ArrayList getLatParamVals()
           
 Parameter getLonParam()
          returns ParameterListParameter
 ArrayList getLonParamVals()
           
 double getLowerSiesmogenicDepth()
           
 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).
 Parameter getNumDipParam()
           
 String getType()
          Returns the name of the parameter class
 double getUpperSiesmogenicDepth()
           
 void initDepthParamList()
          Creates Latitude and Longitude parameters based on the number of the Dips.
 void initDipParamList()
          Creates Dips parameters based on the number of the Dips.
 void initLatLonParamList()
          Creates Latitude and Longitude parameters based on the number of the faultTrace.
 void parameterChange(ParameterChangeEvent event)
          This is the main function of this interface.
 void setAll(double gridSpacing, ArrayList lats, ArrayList lons, ArrayList dips, ArrayList depths, String faultType)
          This sets all the fault data needed to make a evenly discretized fault
 void setAll(String name, double gridSpacing, ArrayList lats, ArrayList lons, ArrayList dips, ArrayList depths, String faultType)
          This sets all the fault data needed to make a evenly discretized fault
 void setDipDirection(double value)
          Sets the Average Dip Direction for the evenly discritized fault.
 void setEvenlyGriddedSurfaceFromParams()
          creates the evenly gridded surface from the fault parameter.
 boolean setIndividualParamValueFromXML(Element el)
          This should set the value of this individual parameter.
 void setNumDips(int numDips)
          Sets the Num Dips
 void setNumFaultTracePoints(int numPoints)
          Sets the Num Fault Trace Points
 
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, 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

FAULT_NAME

public static final String FAULT_NAME
See Also:
Constant Field Values

GRID_SPACING

public static final String GRID_SPACING
See Also:
Constant Field Values

GRID_SPACING_UNITS

public static final String GRID_SPACING_UNITS
See Also:
Constant Field Values

NUMBER_OF_FAULT_TRACE

public static final String NUMBER_OF_FAULT_TRACE
See Also:
Constant Field Values

NUM_DIPS

public static final String NUM_DIPS
See Also:
Constant Field Values

DEPTH_PARAM_NAME

public static final String DEPTH_PARAM_NAME
See Also:
Constant Field Values

DIP_PARAM_NAME

public static final String DIP_PARAM_NAME
See Also:
Constant Field Values

LON_PARAM_NAME

public static final String LON_PARAM_NAME
See Also:
Constant Field Values

LAT_PARAM_NAME

public static final String LAT_PARAM_NAME
See Also:
Constant Field Values

DEFAULT_NUM_FAULT_TRACE

public static final int DEFAULT_NUM_FAULT_TRACE
See Also:
Constant Field Values

DEFAULT_DIPS

public static final int DEFAULT_DIPS
See Also:
Constant Field Values

latlonCols

public static final int latlonCols
See Also:
Constant Field Values

DEFAULT_GRID_SPACING

public static final double DEFAULT_GRID_SPACING
See Also:
Constant Field Values

LAT_TITLE

public static final String LAT_TITLE
See Also:
Constant Field Values

LON_TITLE

public static final String LON_TITLE
See Also:
Constant Field Values

DIP_TITLE

public static final String DIP_TITLE
See Also:
Constant Field Values

DEPTH_TITLE

public static final String DEPTH_TITLE
See Also:
Constant Field Values

FAULT_TYPE_TITLE

public static final String FAULT_TYPE_TITLE
See Also:
Constant Field Values

FRANKEL

public static final String FRANKEL
See Also:
Constant Field Values

STIRLING

public static final String STIRLING
See Also:
Constant Field Values

DIP_DIRECTION_PARAM_NAME

public static final String DIP_DIRECTION_PARAM_NAME
DoubleParameter for Ave. Dip Direction, if the person has selected Stirling Fault Model

See Also:
Constant Field Values
Constructor Detail

SimpleFaultParameter

public SimpleFaultParameter(String name)
No constraints specified for this parameter. Sets the name of this parameter.

Parameters:
name - Name of the parameter

SimpleFaultParameter

public SimpleFaultParameter(String name,
                            AbstractEvenlyGriddedSurfaceWithSubsets surface)
No constraints specified, all values allowed. Sets the name and value.

Parameters:
name - Name of the parameter
surface - EvenlyGriddedSurface object
Method Detail

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

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

getFaultTraceParamList

public ParameterList getFaultTraceParamList()
Returns:
the ParameterList comprising of following parameters: 1)name of the fault 2)Grid Spacing 3)Num of the Flt Trace

getLatParam

public Parameter getLatParam()
returns ParameterListParameter

Returns:
the Parameter comprising of all the latitudes

getLonParam

public Parameter getLonParam()
returns ParameterListParameter

Returns:
the Parameter comprising of all the longitudes

getDepthParam

public Parameter getDepthParam()
returns ParameterListParameter

Returns:
the Parameter comprising of all the depths

getDipParam

public Parameter getDipParam()
returns ParameterListParameter

Returns:
the Parameter comprising of all the dips

getNumDipParam

public Parameter getNumDipParam()
Returns:
the parameter for the number of Dips

getFaultTypeParam

public Parameter getFaultTypeParam()
Returns:
the parameter for selected fault type

getDipDirectionParam

public Parameter getDipDirectionParam()
Returns:
the parameter for Dip direction

parameterChange

public void parameterChange(ParameterChangeEvent event)
This is the main function of this interface. Any time a control paramater or independent paramater is changed by the user this function is called, and a paramater change event is passed in.

Specified by:
parameterChange in interface ParameterChangeListener
Parameters:
event -

getGridSpacing

public double getGridSpacing()
Returns the grid spacing of the Fault Surface.

Returns:

initLatLonParamList

public void initLatLonParamList()
Creates Latitude and Longitude parameters based on the number of the faultTrace. If the user has already specified the values for these parameters once ,it saves those values for future reference. So that when the number of fault-trace changes user does not always have to fill in all the values.


initDipParamList

public void initDipParamList()
Creates Dips parameters based on the number of the Dips. If the user has already specified the values for these parameters once ,it saves those values for future reference. So that when the number of dips changes user does not always have to fill in all the values.


initDepthParamList

public void initDepthParamList()
Creates Latitude and Longitude parameters based on the number of the Dips. If the user has already specified the values for these parameters once ,it saves those values for future reference. So that when the number of dips changes user does not always have to fill in all the values. Number of Depths are always one more than the number of dips


setEvenlyGriddedSurfaceFromParams

public void setEvenlyGriddedSurfaceFromParams()
                                       throws RuntimeException
creates the evenly gridded surface from the fault parameter. This function has to be called explicitly in order to Create/Update the gridded surface , if user is not using the GUI.

Throws:
RuntimeException

getFaultTrace

public FaultTrace getFaultTrace()
Returns:
the fault trace

getUpperSiesmogenicDepth

public double getUpperSiesmogenicDepth()
Returns:
the Upper Siesmogenic depth

getLowerSiesmogenicDepth

public double getLowerSiesmogenicDepth()
Returns:
the Lower Siesmogenic depth

setNumFaultTracePoints

public void setNumFaultTracePoints(int numPoints)
Sets the Num Fault Trace Points

Parameters:
numPoints - number of locations on the fault trace

setNumDips

public void setNumDips(int numDips)
Sets the Num Dips

Parameters:
numDips -

getFaultName

public String getFaultName()
Returns:
the name of the fault

setDipDirection

public void setDipDirection(double value)
Sets the Average Dip Direction for the evenly discritized fault. By Default its value is NaN and its value can only be set if one has selected the Fault type to be Stirling


setAll

public void setAll(String name,
                   double gridSpacing,
                   ArrayList lats,
                   ArrayList lons,
                   ArrayList dips,
                   ArrayList depths,
                   String faultType)
This sets all the fault data needed to make a evenly discretized fault

Parameters:
name - : Name of the fault
gridSpacing -
lats - : ArrayList of Latitudes for the discretized fault
lons - : ArrayList of Longitudes for the discretized fault
dips - : ArrayList of Dips
depths - : ArrayList of Depths, which are one more then the number of dips
faultType - : STIRLING or FRANKEL fault

setAll

public void setAll(double gridSpacing,
                   ArrayList lats,
                   ArrayList lons,
                   ArrayList dips,
                   ArrayList depths,
                   String faultType)
This sets all the fault data needed to make a evenly discretized fault

Parameters:
gridSpacing -
lats - : ArrayList of Latitudes for the discretized fault
lons - : ArrayList of Longitudes for the discretized fault
dips - : ArrayList of Dips
depths - : ArrayList of Depths, which are one more then the number of dips
faultType - : STIRLING or FRANKEL fault

getLatParamVals

public ArrayList getLatParamVals()
Returns:
the ArrayList containing the values for all the specified Latitudes

getLonParamVals

public ArrayList getLonParamVals()
Returns:
the ArrayList containing the values for all the specified Longitudes

getDipParamVals

public ArrayList getDipParamVals()
Returns:
the ArrayList containing the values for all the specified Dips

getDepthParamVals

public ArrayList getDepthParamVals()
Returns:
the ArrayList containing the values for all the specified Depths

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

getType

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

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

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