org.opensha.sha.util
Class TRTUtils

java.lang.Object
  extended by org.opensha.sha.util.TRTUtils

public class TRTUtils
extends Object


Constructor Summary
TRTUtils()
           
 
Method Summary
static ScalarIMR getFirstIMR(Map<TectonicRegionType,ScalarIMR> imrMap)
          Simply returns the first IMR in the map by calling imrMap.values().iterator().next().
static ScalarIMR getIMRforTRT(Map<TectonicRegionType,ScalarIMR> imrMap, TectonicRegionType trt)
          This will return the IMR for the given Tectonic Region Type.
static HashMap<ScalarIMR,TectonicRegionType> getTRTsSetInIMR(Collection<ScalarIMR> imrs)
          This gets a mapping of the TRTs as set in each IMR.
static HashMap<ScalarIMR,TectonicRegionType> getTRTsSetInIMRs(Map<TectonicRegionType,ScalarIMR> imrMap)
          This gets a mapping of the TRTs as set in each IMR.
static void resetTRTsInIMRs(Map<ScalarIMR,TectonicRegionType> trtValues)
          Resets TRTs in each IMR to the values specified.
static void setTRTinIMR(ScalarIMR imr, TectonicRegionType trt, NonSupportedTRT_OptionsParam nonSupportedTRT_OptionsParam, TectonicRegionType originalTRT)
          Sets the TRT param in the given IMR.
static HashMap<TectonicRegionType,ScalarIMR> wrapInHashMap(ScalarIMR imr)
          This wraps a single IMR in a HashMap with a single TRT, Active Shallow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TRTUtils

public TRTUtils()
Method Detail

wrapInHashMap

public static HashMap<TectonicRegionType,ScalarIMR> wrapInHashMap(ScalarIMR imr)
This wraps a single IMR in a HashMap with a single TRT, Active Shallow.

Parameters:
imr - - Intensity Measure Relationship to wrap
Returns:
mapping of IMR's to TRT's with only a single mapping of active shallow to the given IMR.

getIMRforTRT

public static ScalarIMR getIMRforTRT(Map<TectonicRegionType,ScalarIMR> imrMap,
                                     TectonicRegionType trt)
This will return the IMR for the given Tectonic Region Type. If the map has only a single mapping, the first (and only) IMR in the map is returned without checking that the Tectonic Region Types match. The TRT is NOT set in the IMR. To do this, see setTRTinIMR

Parameters:
imrMap - - Mapping of IMR's to TRT's
trt - - Tectonic Region Type for which to retrieve an IMR
Returns:
Single IMR with TRT param set
See Also:
setTRTinIMR

setTRTinIMR

public static void setTRTinIMR(ScalarIMR imr,
                               TectonicRegionType trt,
                               NonSupportedTRT_OptionsParam nonSupportedTRT_OptionsParam,
                               TectonicRegionType originalTRT)
Sets the TRT param in the given IMR. If the IMR doesn't support the TRT (determined by imr.isTectonicRegionSupported(trt.toString())) then the TRT param is set according to the NonSupportedTRT_OptionsParam param.

Parameters:
imr - - Intensity Measure Relationship in which to set the TRT
trt - - Tectonic Region Type to set in the IMR

getTRTsSetInIMRs

public static HashMap<ScalarIMR,TectonicRegionType> getTRTsSetInIMRs(Map<TectonicRegionType,ScalarIMR> imrMap)
This gets a mapping of the TRTs as set in each IMR. This is keeping track of the user's TRT settings for each parameter when they might change during a calculation. NOTE: This does NOT get the default value, but the CURRENTLY SET value.

Returns:
mapping of IMRs to their currently set TRT

getTRTsSetInIMR

public static HashMap<ScalarIMR,TectonicRegionType> getTRTsSetInIMR(Collection<ScalarIMR> imrs)
This gets a mapping of the TRTs as set in each IMR. This is keeping track of the user's TRT settings for each parameter when they might change during a calculation. If the IMR's TRT param is null, it will first be set as default. NOTE: This does NOT get the default value, but the CURRENTLY SET value.

Returns:
mapping of IMRs to their currently set TRT

resetTRTsInIMRs

public static void resetTRTsInIMRs(Map<ScalarIMR,TectonicRegionType> trtValues)
Resets TRTs in each IMR to the values specified. Can be used to restore values recorded with getTRTsSetInIMR.

Parameters:
trtValues - - IMR to TRT mapping to reset
See Also:
getTRTsSetInIMR

getFirstIMR

public static ScalarIMR getFirstIMR(Map<TectonicRegionType,ScalarIMR> imrMap)
Simply returns the first IMR in the map by calling imrMap.values().iterator().next(). This is useful for returning the only IMR out of a map with a single TRT.

Parameters:
imrMap - - Mapping of IMR's to TRT's
Returns:
first IMR in the map