org.jscience.ml.gml.infoset
Class CoordinateTupleImpl

java.lang.Object
  extended by org.jscience.ml.gml.infoset.CoordinateTupleImpl
All Implemented Interfaces:
CoordinateTuple

public class CoordinateTupleImpl
extends java.lang.Object
implements CoordinateTuple

Convenience class that implements the CoordinateTuple interface. This class can either be used directly or be extended to add custom functionality. A coordinate tuple must have at least the X coordinate.


Field Summary
 
Fields inherited from interface org.jscience.ml.gml.infoset.CoordinateTuple
X_INDEX, Y_INDEX, Z_INDEX
 
Constructor Summary
protected CoordinateTupleImpl()
          Creates a "dummy" CoordinateTuple object.
  CoordinateTupleImpl(Coordinate[] coordinates)
          Initializes this coordinate tuple using the given coordinates.
 
Method Summary
 Coordinate getCoordinate(int index)
          Returns the n-th coordinate of this coordinate tuple.
protected  Coordinate[] getCoordinates()
          Provides access to internal coordinates' structure.
 Coordinate getX()
          Convenience method to retrieve the first coordinate.
 Coordinate getY()
          Convenience method to retrieve the second coordinate.
 Coordinate getZ()
          Convenience method to retrieve the third coordinate.
protected  void initialize(Coordinate[] coordinates)
          Initializes this coordinate tuple.
 java.lang.String toString()
          Returns a one-line string representation of this coordinate tuple.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoordinateTupleImpl

protected CoordinateTupleImpl()
Creates a "dummy" CoordinateTuple object. This constructor is meant to be used only by subclasses.


CoordinateTupleImpl

public CoordinateTupleImpl(Coordinate[] coordinates)
Initializes this coordinate tuple using the given coordinates. The content of the array is copied.

Parameters:
coordinates - DOCUMENT ME!
Method Detail

initialize

protected void initialize(Coordinate[] coordinates)
Initializes this coordinate tuple. The array is trimmed from the first unoccupied slot.

Parameters:
coordinates - The source array. Array members are copied into a new array, but they are not cloned.

getX

public Coordinate getX()
Convenience method to retrieve the first coordinate.

Specified by:
getX in interface CoordinateTuple
Returns:
DOCUMENT ME!

getY

public Coordinate getY()
Convenience method to retrieve the second coordinate.

Specified by:
getY in interface CoordinateTuple
Returns:
DOCUMENT ME!

getZ

public Coordinate getZ()
Convenience method to retrieve the third coordinate.

Specified by:
getZ in interface CoordinateTuple
Returns:
DOCUMENT ME!

getCoordinate

public Coordinate getCoordinate(int index)
Returns the n-th coordinate of this coordinate tuple.

Specified by:
getCoordinate in interface CoordinateTuple
Parameters:
index - Represents an index into the coordinate tuple. The lowest index is 0.
Returns:
Returns null if the index is out of range.

toString

public java.lang.String toString()
Returns a one-line string representation of this coordinate tuple.

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

getCoordinates

protected Coordinate[] getCoordinates()
Provides access to internal coordinates' structure. Meant to be used by subclasses.

Returns:
DOCUMENT ME!