org.opensha.commons.data.siteData
Class SiteDataValueList<E>

java.lang.Object
  extended by org.opensha.commons.data.siteData.SiteDataValueList<E>
Type Parameters:
E -
All Implemented Interfaces:
Serializable, XMLSaveable

public class SiteDataValueList<E>
extends Object
implements XMLSaveable, Serializable

This class represents a list of site data values. The advantage that it has over an ArrayList of SiteDataValue objects is that it only stores the metadata for the values once, instead of once for each value.

Author:
Kevin Milner
See Also:
Serialized Form

Field Summary
static String XML_METADATA_NAME
           
 
Constructor Summary
SiteDataValueList(ArrayList<E> values, SiteData<E> source)
           
SiteDataValueList(ArrayList<E> values, SiteData<E> source, LocationList locs)
           
SiteDataValueList(String dataType, String dataMeasurementType, ArrayList<E> values, String sourceName)
           
SiteDataValueList(String dataType, String dataMeasurementType, ArrayList<E> values, String sourceName, LocationList locs)
           
 
Method Summary
static SiteDataValueList<?> fromXMLMetadata(Element dataElement)
           
 String getFlag()
           
 Location getLocationAt(int index)
           
 LocationList getLocationList()
           
 String getSourceName()
           
 String getType()
           
 SiteDataValue<E> getValue(int index)
          Get an annotated value for the given location.
 E getValueForLocation(Location loc)
           
 ArrayList<E> getValues()
           
 boolean hasLocations()
           
static void main(String[] args)
           
 int size()
           
 String toString()
           
 Element toXMLMetadata(Element root)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_METADATA_NAME

public static final String XML_METADATA_NAME
See Also:
Constant Field Values
Constructor Detail

SiteDataValueList

public SiteDataValueList(ArrayList<E> values,
                         SiteData<E> source)

SiteDataValueList

public SiteDataValueList(ArrayList<E> values,
                         SiteData<E> source,
                         LocationList locs)

SiteDataValueList

public SiteDataValueList(String dataType,
                         String dataMeasurementType,
                         ArrayList<E> values,
                         String sourceName)

SiteDataValueList

public SiteDataValueList(String dataType,
                         String dataMeasurementType,
                         ArrayList<E> values,
                         String sourceName,
                         LocationList locs)
Method Detail

getType

public String getType()

getFlag

public String getFlag()

getValue

public SiteDataValue<E> getValue(int index)
Get an annotated value for the given location.

Parameters:
index -
Returns:

getLocationAt

public Location getLocationAt(int index)

getValues

public ArrayList<E> getValues()

getValueForLocation

public E getValueForLocation(Location loc)

getSourceName

public String getSourceName()

size

public int size()

getLocationList

public LocationList getLocationList()

hasLocations

public boolean hasLocations()

toString

public String toString()
Overrides:
toString in class Object

toXMLMetadata

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

fromXMLMetadata

public static final SiteDataValueList<?> fromXMLMetadata(Element dataElement)

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException