org.opensha.commons.data.xyz
Class ArbDiscrGeoDataSet

java.lang.Object
  extended by org.opensha.commons.data.xyz.AbstractXYZ_DataSet
      extended by org.opensha.commons.data.xyz.AbstractGeoDataSet
          extended by org.opensha.commons.data.xyz.ArbDiscrGeoDataSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, GeoDataSet, XYZ_DataSet

public class ArbDiscrGeoDataSet
extends AbstractGeoDataSet

This class represents an arbitrarily discretized geographic dataset. It is backed by Locations (in a HashMap). This should be used for scattered XYZ data or maps where it is impractical or unnecessary to use the evenly discretized version.

Author:
kevin
See Also:
Serialized Form

Constructor Summary
ArbDiscrGeoDataSet(boolean latitudeX)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean contains(Location loc)
          Returns true if the dataset contains the given Location, false otherwise.
 ArbDiscrGeoDataSet copy()
          Returns a shallow copy of this GeoDataSet.
 double get(Location loc)
          Get the value at the given Location, or null if it doesn't exist.
 Location getLocation(int index)
          Returns the location at the given index.
 LocationList getLocationList()
          Returns a list of all locations in the correct order (as defined by indexOf).
 int indexOf(Location loc)
          Returns the index of the given location, or -1 if it doesn't exist.
static ArbDiscrGeoDataSet loadXYZFile(java.lang.String fileName, boolean latitudeX)
           
 void set(Location loc, double value)
          Set the value at the given Location.
 int size()
          Returns the size of this dataset.
static void writeXYZFile(XYZ_DataSet xyz, java.lang.String fileName)
           
 
Methods inherited from class org.opensha.commons.data.xyz.AbstractGeoDataSet
contains, contains, get, get, get, getMaxLat, getMaxLon, getMaxX, getMaxY, getMaxZ, getMinLat, getMinLon, getMinX, getMinY, getMinZ, getPoint, getPointList, getValueList, getZTracker, indexOf, indexOf, isLatitudeX, locToPoint, ptToLoc, set, set, set, setAll, setLatitudeX
 
Methods inherited from class org.opensha.commons.data.xyz.AbstractXYZ_DataSet
abs, add, exp, exp, log, log10, pow, scale, writeXYZFile
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensha.commons.data.xyz.XYZ_DataSet
abs, add, exp, exp, log, log10, pow, scale
 

Constructor Detail

ArbDiscrGeoDataSet

public ArbDiscrGeoDataSet(boolean latitudeX)
Method Detail

set

public void set(Location loc,
                double value)
Description copied from interface: GeoDataSet
Set the value at the given Location. If the location doesn't exist in the dataset then it will be added.

Parameters:
loc - - the location at which to set
value - - the value to set

get

public double get(Location loc)
Description copied from interface: GeoDataSet
Get the value at the given Location, or null if it doesn't exist.

Parameters:
loc - - the location at which to get
Returns:
the value at the given location

indexOf

public int indexOf(Location loc)
Description copied from interface: GeoDataSet
Returns the index of the given location, or -1 if it doesn't exist.

Parameters:
loc - - the location at which to return the index
Returns:
the index of the given location, or -1 if it isn't in the dataset.

getLocation

public Location getLocation(int index)
Description copied from interface: GeoDataSet
Returns the location at the given index. If index < 0 or index >= size(), an exception will be thrown.

Parameters:
index - - the index at which to get the location
Returns:
the location at the given index

contains

public boolean contains(Location loc)
Description copied from interface: GeoDataSet
Returns true if the dataset contains the given Location, false otherwise.

Parameters:
loc - - the location to test
Returns:
true if the dataset contains the given location, false otherwise

loadXYZFile

public static ArbDiscrGeoDataSet loadXYZFile(java.lang.String fileName,
                                             boolean latitudeX)
                                      throws java.io.FileNotFoundException,
                                             java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

writeXYZFile

public static void writeXYZFile(XYZ_DataSet xyz,
                                java.lang.String fileName)
                         throws java.io.IOException
Throws:
java.io.IOException

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

copy

public ArbDiscrGeoDataSet copy()
Description copied from interface: GeoDataSet
Returns a shallow copy of this GeoDataSet. Internal points are not cloned.

Returns:
shallow copy of this GeoDataSet

getLocationList

public LocationList getLocationList()
Description copied from interface: GeoDataSet
Returns a list of all locations in the correct order (as defined by indexOf).

Returns:
list of all locations in the dataset

size

public int size()
Description copied from interface: XYZ_DataSet
Returns the size of this dataset.

Returns:
size of this dataset