org.opensha.sha.earthquake
Class AbstractEpistemicListERF

java.lang.Object
  extended by org.opensha.sha.earthquake.AbstractEpistemicListERF
All Implemented Interfaces:
Serializable, Comparable<BaseERF>, EventListener, Named, XMLSaveable, ParameterChangeListener, TimeSpanChangeListener, BaseERF, EpistemicListERF
Direct Known Subclasses:
NSHMP_ListERF, PEER_LogicTreeERF_List, Point2MultVertSS_FaultERF_List, UCERF2_TimeIndependentEpistemicList, WG02_ERF_Epistemic_List, WG02_FortranWrappedERF_EpistemicList, YuccaMountainERF_List

public abstract class AbstractEpistemicListERF
extends Object
implements EpistemicListERF, TimeSpanChangeListener, ParameterChangeListener, XMLSaveable

Title: AbstractEpistemicListERF (was ERF_List)

Description: This is the abstract implementation of ERF_EpistemicListAPI

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
: Edward (Ned) Field, Nitin Gupta and Vipin Gupta
See Also:
Serialized Form

Field Summary
protected  ParameterList adjustableParams
           
protected  ArrayList<ERF> erf_List
           
protected  boolean parameterChangeFlag
           
protected  TimeSpan timeSpan
           
static String XML_METADATA_NAME
           
 
Fields inherited from interface org.opensha.sha.earthquake.BaseERF
NAME
 
Constructor Summary
AbstractEpistemicListERF()
           
 
Method Summary
protected  void addERF(AbstractERF eqkRupForecast, double relWeight)
          add a new Eqk Rup forecast to the list
 int compareTo(BaseERF o)
           
static BaseERF fromXMLMetadata(Element el)
           
 ParameterList getAdjustableParameterList()
          Gets the Adjustable parameter list for the ERF
 ListIterator<Parameter<?>> getAdjustableParamsIterator()
          return the list of adjustable params
 Region getApplicableRegion()
          Get the region for which this forecast is applicable
 double getERF_RelativeWeight(int index)
          get the weight of the ERF at the specified index
 ERF getERF(int index)
          get the ERF in the list with the specified index
 ArrayList<TectonicRegionType> getIncludedTectonicRegionTypes()
          This specifies what types of Tectonic Regions are included in the ERF.
 String getName()
          get the name of this class
 int getNumERFs()
          get the number of Eqk Rup Forecasts in this list
 Parameter getParameter(String paramName)
          This function returns the parameter with specified name from adjustable param list
 ArrayList<Double> getRelativeWeightsList()
          Return the vector containing the Double values with relative weights for each ERF
 TimeSpan getTimeSpan()
          get the timespan
 void parameterChange(ParameterChangeEvent event)
          This is the main function of this interface.
 void setParameter(String name, Object value)
          Loops over all the adjustable parameters and set parameter with the given name to the given value.
 void setParameterChangeFlag(boolean flag)
          sets the value for the parameter change flag
 void setTimeSpan(TimeSpan time)
          This method sets the time-span field.
 void timeSpanChange(EventObject event)
          Function that must be implemented by all Timespan Listeners for ParameterChangeEvents.
 Element toXMLMetadata(Element root)
           
 Element toXMLMetadata(Element root, int index)
           
 String updateAndSaveForecast()
          Update the forecast and save it in serialized mode into a file
 void updateForecast()
          update the list of the ERFs based on the new parameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_METADATA_NAME

public static final String XML_METADATA_NAME
See Also:
Constant Field Values

erf_List

protected ArrayList<ERF> erf_List

parameterChangeFlag

protected boolean parameterChangeFlag

adjustableParams

protected ParameterList adjustableParams

timeSpan

protected TimeSpan timeSpan
Constructor Detail

AbstractEpistemicListERF

public AbstractEpistemicListERF()
Method Detail

addERF

protected void addERF(AbstractERF eqkRupForecast,
                      double relWeight)
add a new Eqk Rup forecast to the list

Parameters:
eqkRupForecast -

getNumERFs

public int getNumERFs()
get the number of Eqk Rup Forecasts in this list

Specified by:
getNumERFs in interface EpistemicListERF
Returns:
: number of eqk rup forecasts in this list

getERF

public ERF getERF(int index)
get the ERF in the list with the specified index

Specified by:
getERF in interface EpistemicListERF
Parameters:
index - : index of Eqk rup forecast to return
Returns:

getERF_RelativeWeight

public double getERF_RelativeWeight(int index)
get the weight of the ERF at the specified index

Specified by:
getERF_RelativeWeight in interface EpistemicListERF
Parameters:
index - : index of ERF
Returns:
: relative weight of ERF

getRelativeWeightsList

public ArrayList<Double> getRelativeWeightsList()
Return the vector containing the Double values with relative weights for each ERF

Specified by:
getRelativeWeightsList in interface EpistemicListERF
Returns:
: ArrayList of Double values

getAdjustableParamsIterator

public ListIterator<Parameter<?>> getAdjustableParamsIterator()
return the list of adjustable params

Returns:

getName

public String getName()
get the name of this class

Specified by:
getName in interface Named
Returns:

updateForecast

public void updateForecast()
update the list of the ERFs based on the new parameters

Specified by:
updateForecast in interface BaseERF

getApplicableRegion

public Region getApplicableRegion()
Get the region for which this forecast is applicable

Specified by:
getApplicableRegion in interface BaseERF
Returns:
: Geographic region object specifying the applicable region of forecast

setTimeSpan

public void setTimeSpan(TimeSpan time)
This method sets the time-span field.

Specified by:
setTimeSpan in interface BaseERF
Parameters:
time -

getAdjustableParameterList

public ParameterList getAdjustableParameterList()
Description copied from interface: BaseERF
Gets the Adjustable parameter list for the ERF

Specified by:
getAdjustableParameterList in interface BaseERF
Returns:
the adjustable ParameterList for the ERF

getTimeSpan

public TimeSpan getTimeSpan()
get the timespan

Specified by:
getTimeSpan in interface BaseERF
Returns:
: TimeSpan

timeSpanChange

public void timeSpanChange(EventObject event)
Function that must be implemented by all Timespan Listeners for ParameterChangeEvents.

Specified by:
timeSpanChange in interface TimeSpanChangeListener
Parameters:
event - The Event which triggered this function call

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 in a GUI this function is called, and a paramater change event is passed in. This sets the flag to indicate that the sources need to be updated

Specified by:
parameterChange in interface ParameterChangeListener
Parameters:
event -

setParameterChangeFlag

public void setParameterChangeFlag(boolean flag)
sets the value for the parameter change flag

Parameters:
flag -

updateAndSaveForecast

public String updateAndSaveForecast()
Update the forecast and save it in serialized mode into a file

Specified by:
updateAndSaveForecast in interface BaseERF
Returns:

getParameter

public Parameter getParameter(String paramName)
This function returns the parameter with specified name from adjustable param list

Parameters:
paramName - : Name of the parameter needed from adjustable param list
Returns:
: ParamterAPI instance

setParameter

public void setParameter(String name,
                         Object value)
Description copied from interface: BaseERF
Loops over all the adjustable parameters and set parameter with the given name to the given value. First checks if the parameter is contained within the ERF adjustable parameter list or TimeSpan adjustable parameters list. If not then IllegalArgumentException is thrown.

Specified by:
setParameter in interface BaseERF
Parameters:
name - String Name of the Adjustable Parameter
value - Object Parameeter Value

getIncludedTectonicRegionTypes

public ArrayList<TectonicRegionType> getIncludedTectonicRegionTypes()
This specifies what types of Tectonic Regions are included in the ERF. This default implementation includes only ACTIVE_SHALLOW, so it should be overridden in subclasses if other types are used

Specified by:
getIncludedTectonicRegionTypes in interface BaseERF
Returns:
: ArrayList

compareTo

public int compareTo(BaseERF o)
Specified by:
compareTo in interface Comparable<BaseERF>

toXMLMetadata

public Element toXMLMetadata(Element root)
Specified by:
toXMLMetadata in interface XMLSaveable

toXMLMetadata

public Element toXMLMetadata(Element root,
                             int index)

fromXMLMetadata

public static BaseERF fromXMLMetadata(Element el)
                               throws InvocationTargetException
Throws:
InvocationTargetException