org.opensha.commons.data.xyz
Class ArbDiscrXYZ_DataSet

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

public class ArbDiscrXYZ_DataSet
extends AbstractXYZ_DataSet

Title: ArbDiscrXYZ_DataSet

Description: This class creates a vector for the XYZ dataset. Points can be arbitrarily distributed. This class is backed by the Point2D class and a HashMap.

Copyright: Copyright (c) 2002

Company:

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

Constructor Summary
ArbDiscrXYZ_DataSet()
           
 
Method Summary
 Object clone()
           
 boolean contains(double x, double y)
          Returns true if the dataset contains the given point, false otherwise.
 boolean contains(Point2D point)
          Returns true if the dataset contains the given point, false otherwise.
 ArbDiscrXYZ_DataSet copy()
          Returns a shallow copy of this XYZ_DataSet.
 double get(double x, double y)
          Gets the value at the given point.
 double get(int index)
          Gets the value at the given index.
 double get(Point2D point)
          Gets the value at the given point.
 Point2D getPoint(int index)
          Gets the point at the given index.
 List<Point2D> getPointList()
          Returns a list of all points in the correct order (as defined by indexOf).
 int indexOf(double x, double y)
          Returns the index of the given point, or -1 if it isn't in the dataset.
 int indexOf(Point2D point)
          Returns the index of the given point, or -1 if it isn't in the dataset.
static ArbDiscrXYZ_DataSet loadXYZFile(String fileName)
           
 void set(double x, double y, double z)
          Sets the value at the given point.
 void set(int index, double z)
          Sets the value at the given index.
 void set(Point2D point, double z)
          Sets the value at the given point.
 int size()
          Returns the size of this dataset.
 
Methods inherited from class org.opensha.commons.data.xyz.AbstractXYZ_DataSet
abs, add, exp, exp, getMaxX, getMaxY, getMaxZ, getMinX, getMinY, getMinZ, getValueList, log, log10, pow, scale, setAll, writeXYZFile, writeXYZFile
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArbDiscrXYZ_DataSet

public ArbDiscrXYZ_DataSet()
Method Detail

set

public void set(Point2D point,
                double z)
Description copied from interface: XYZ_DataSet
Sets the value at the given point. If the point doesn't exist, it will be added to the dataset.

Parameters:
point - - the point at which to set
z - - the value to set

set

public void set(double x,
                double y,
                double z)
Description copied from interface: XYZ_DataSet
Sets the value at the given point. If the point doesn't exist, it will be added to the dataset.

Parameters:
x - - the x value of the point at which to set
y - - the y value of the point at which to set
z - - the value to set

set

public void set(int index,
                double z)
Description copied from interface: XYZ_DataSet
Sets the value at the given index. If index < 0 or index >= size(), then an exception is thrown.

Parameters:
index - - the index of the point to be set
z - - the value to set

get

public double get(Point2D point)
Description copied from interface: XYZ_DataSet
Gets the value at the given point. If the point doesn't exist, null will be returned.

Parameters:
point - - the point at which to get
Returns:
the value at the given point, or null if the point is not contained in the dataset

get

public double get(double x,
                  double y)
Description copied from interface: XYZ_DataSet
Gets the value at the given point. If the point doesn't exist, null will be returned.

Parameters:
x - - the x value of the point at which to get
y - - the y value of the point at which to get
Returns:
the value at the given point

get

public double get(int index)
Description copied from interface: XYZ_DataSet
Gets the value at the given index. If index < 0 or index >= size(), then an exception is thrown.

Parameters:
index - - the index of the point at which to get
Returns:
the value at the given index

getPoint

public Point2D getPoint(int index)
Description copied from interface: XYZ_DataSet
Gets the point at the given index. If index < 0 or index >= size(), then an exception is thrown.

Parameters:
index - - the index of the point to get
Returns:
the point at the given index

indexOf

public int indexOf(Point2D point)
Description copied from interface: XYZ_DataSet
Returns the index of the given point, or -1 if it isn't in the dataset.

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

contains

public boolean contains(Point2D point)
Description copied from interface: XYZ_DataSet
Returns true if the dataset contains the given point, false otherwise.

Parameters:
point - - the point to check
Returns:
true if point is not null and is contained by the dataset, false otherwise

contains

public boolean contains(double x,
                        double y)
Description copied from interface: XYZ_DataSet
Returns true if the dataset contains the given point, false otherwise.

Parameters:
x - - the x value of the point to check
y - - the y value of the point to check
Returns:
true if the dataset contains the given point, false otherwise

size

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

Returns:
size of this dataset

clone

public Object clone()
Overrides:
clone in class Object

copy

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

Returns:
shallow copy of this XYZ_DataSet

indexOf

public int indexOf(double x,
                   double y)
Description copied from interface: XYZ_DataSet
Returns the index of the given point, or -1 if it isn't in the dataset.

Parameters:
x - - the x value of the point at which to return the index
y - - the y value of the point at which to return the index
Returns:
index of the given point, or -1 if it isn't in the dataset.

getPointList

public List<Point2D> getPointList()
Description copied from interface: XYZ_DataSet
Returns a list of all points in the correct order (as defined by indexOf). If the dataset is empty, then an empty list will be returned.

Specified by:
getPointList in interface XYZ_DataSet
Overrides:
getPointList in class AbstractXYZ_DataSet
Returns:
list of all points in the dataset

loadXYZFile

public static ArbDiscrXYZ_DataSet loadXYZFile(String fileName)
                                       throws FileNotFoundException,
                                              IOException
Throws:
FileNotFoundException
IOException