org.opensha.commons.data
Class Site

java.lang.Object
  extended by org.opensha.commons.param.ParameterList
      extended by org.opensha.commons.data.Site
All Implemented Interfaces:
Serializable, Iterable<Parameter<?>>, Named, XMLSaveable

public class Site
extends ParameterList
implements Named, Serializable, XMLSaveable

Title: Site

Description: This class hold the information about a geographical site. It has been generalized by extendign a ParameterList so that any site parameters can be contained within this Site object. The Site object is really a specialized collection of parameters associated with a Location object, i.e. latitude and longitude.

Each Parameter within the list represents a site parameter used by an IntensityMeasureRelationship. The constructor will create some default Parameters for previously published relationships (e.g. AS_1997, Campbell_1997, Sadigh_1997, Field_1997, and Abrahamson_2000), but a method will also be provided so that one can add others if so desired.

An IntensityMeasureRalationship object will request whatever Parameter values it needs from the Site object that is passed into the IMR.

Provide methods for setting all site parameters from, for example, Vs30 (authors must approve how this is done)?

Note that the Site class implements NamedObjectAPI. This is usefull for giving a Site a name, such as "Los Angeles".

Version:
1.0
Author:
Sid Hellman, Steven W. Rock
See Also:
Serialized Form

Field Summary
protected static String C
          Class name - used for debugging
protected static boolean D
          Boolean when set prints out debugging statements
protected  Location location
          Location of this site
 String name
          Name of the site.
static String XML_METADATA_LIST_NAME
           
static String XML_METADATA_NAME
           
static String XML_PARAMS_NAME
           
 
Fields inherited from class org.opensha.commons.param.ParameterList
constraintNameMap, params
 
Constructor Summary
Site()
          No-Arg Constructor for the Site object.
Site(Location location)
          Constructor for the Site object that sets the location.
Site(Location location, String name)
          Constructor for the Site object that sets the site location and the name.
 
Method Summary
 Object clone()
          Returns a copy of this list, therefore any changes to the copy cannot affect this original list.
 boolean equals(Object obj)
          Returns true if all the parameters have the same names and values.
static Site fromXMLMetadata(Element siteEl, ArrayList<Parameter<?>> paramsToAdd)
           
 Location getLocation()
          Returns the location of this Site.
 String getName()
          Returns the name of the Site.
static ArrayList<Site> loadSitesFromXML(Element sitesEl, ArrayList<Parameter<?>> paramsToAdd)
           
 void setLocation(Location location)
          Sets the location of this Site.
 void setName(String name)
          Sets the name of the Site.
 String toString()
          Represents the current state of the Site parameters and variables as a String.
 Element toXMLMetadata(Element root)
           
static Element writeSitesToXML(List<Site> sites, Element root)
           
 
Methods inherited from class org.opensha.commons.param.ParameterList
addParameter, addParameter, addParameterList, clear, compareTo, containsParameter, containsParameter, equalNames, getByIndex, getByIndex, getParameter, getParameter, getParameterListMetadataString, getParameterListMetadataString, getParameterName, getParameterNamesIterator, getParametersIterator, getType, getValue, isEmpty, iterator, removeParameter, removeParameter, replaceParameter, setParamsInListFromXML, setValue, size, updateParameter
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

C

protected static final String C
Class name - used for debugging

See Also:
Constant Field Values

XML_METADATA_NAME

public static String XML_METADATA_NAME

XML_PARAMS_NAME

public static String XML_PARAMS_NAME

XML_METADATA_LIST_NAME

public static String XML_METADATA_LIST_NAME

D

protected static final boolean D
Boolean when set prints out debugging statements

See Also:
Constant Field Values

name

public String name
Name of the site.


location

protected Location location
Location of this site

Constructor Detail

Site

public Site()
No-Arg Constructor for the Site object. Currenlty does nothing.


Site

public Site(Location location)
Constructor for the Site object that sets the location.


Site

public Site(Location location,
            String name)
Constructor for the Site object that sets the site location and the name.

Parameters:
location - Site location
name - Site name
Method Detail

setName

public void setName(String name)
Sets the name of the Site.


getName

public String getName()
Returns the name of the Site.

Specified by:
getName in interface Named

setLocation

public void setLocation(Location location)
Sets the location of this Site.


getLocation

public Location getLocation()
Returns the location of this Site.


toString

public String toString()
Represents the current state of the Site parameters and variables as a String. Useful for debugging. Prints out the name, Location and all the parameters in the list.

Overrides:
toString in class ParameterList
Returns:
name, location and all parameters as string

equals

public boolean equals(Object obj)
Description copied from class: ParameterList
Returns true if all the parameters have the same names and values. One use will be to determine if two DisctetizedFunctions are the same, i.e. set up with the same independent parameters.

Overrides:
equals in class ParameterList

clone

public Object clone()
Returns a copy of this list, therefore any changes to the copy cannot affect this original list. The name, Location and each parameter is cloned.

Note: Cloning this object then calling equals() would return true. They are different instances, but have the same values. Modifying one would not affect the second. Equal yet disparet.

Overrides:
clone in class ParameterList

toXMLMetadata

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

fromXMLMetadata

public static Site fromXMLMetadata(Element siteEl,
                                   ArrayList<Parameter<?>> paramsToAdd)

writeSitesToXML

public static Element writeSitesToXML(List<Site> sites,
                                      Element root)

loadSitesFromXML

public static ArrayList<Site> loadSitesFromXML(Element sitesEl,
                                               ArrayList<Parameter<?>> paramsToAdd)