edu.brook.ascape.model
Class CoordinateDiscrete

java.lang.Object
  |
  +--edu.brook.ascape.model.Coordinate
        |
        +--edu.brook.ascape.model.CoordinateDiscrete
Direct Known Subclasses:
Coordinate1DDiscrete

public abstract class CoordinateDiscrete
extends Coordinate
implements java.lang.Cloneable, java.io.Serializable

The base class for a location within a regular discrete space.

Since:
1.0
Version:
1.2
See Also:
Serialized Form

Field Summary
protected  int[] values
          Each element of this array represents the position of this coordinate within a dimension, the index of the element.
 
Constructor Summary
CoordinateDiscrete()
          Creates a new discrete coordinate.
CoordinateDiscrete(int value)
          Creates a new coordinate with the provided position.
CoordinateDiscrete(int[] values)
          Creates a new coordinate with the provided dimensional positions.
 
Method Summary
 int getDimensionCount()
          Returns the number of dimensions this coordinate has.
 int getProduct()
          Returns the product of all the dimension's values.
 int getValueAtDimension(int dimension)
          Gets the value at the specified (1-based) dimension.
 int[] getValues()
          Returns an array of position values for each dimension.
 void setValueAtDimension(int dimension, int value)
          Sets the value at the specified (1-based) dimension.
 void setValues(int[] values)
          Sets the position values for this coordinate.
 java.lang.String toString()
          Returns a string representing this coordinate.
 
Methods inherited from class edu.brook.ascape.model.Coordinate
getDistance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected int[] values
Each element of this array represents the position of this coordinate within a dimension, the index of the element.
Constructor Detail

CoordinateDiscrete

public CoordinateDiscrete()
Creates a new discrete coordinate.

CoordinateDiscrete

public CoordinateDiscrete(int[] values)
Creates a new coordinate with the provided dimensional positions.

CoordinateDiscrete

public CoordinateDiscrete(int value)
Creates a new coordinate with the provided position.
Method Detail

getDimensionCount

public int getDimensionCount()
Returns the number of dimensions this coordinate has.

getValues

public final int[] getValues()
Returns an array of position values for each dimension.

setValues

public final void setValues(int[] values)
Sets the position values for this coordinate.

getValueAtDimension

public final int getValueAtDimension(int dimension)
Gets the value at the specified (1-based) dimension.

setValueAtDimension

public final void setValueAtDimension(int dimension,
                                      int value)
Sets the value at the specified (1-based) dimension.

getProduct

public final int getProduct()
Returns the product of all the dimension's values. (A measure of volume of the region enclosed by {0, ..., n} and this coordinate.)

toString

public java.lang.String toString()
Returns a string representing this coordinate.
Overrides:
toString in class java.lang.Object

(c) 1998-2000 The Brookings Insitution
Webpage