## org.ascape.model.space
Class CoordinateDiscrete

    java.lang.Object
      org.ascape.model.space.Coordinate
          org.ascape.model.space.CoordinateDiscrete

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

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
Author:
  Miles Parker
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
`boolean` `equals(java.lang.Object o)` Determines whether this coordinate is equal to another.
`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.
`int` `hashCode()`
`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 org.ascape.model.space.Coordinate
`add, getDistance`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, 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.

  Parameters:
    `values` - the values

### CoordinateDiscrete

    public CoordinateDiscrete(int value)

  Creates a new coordinate with the provided position.

  Parameters:
    `value` - the value

Method Detail

### getDimensionCount

    public int getDimensionCount()

  Returns the number of dimensions this coordinate has.

  Returns:
    the dimension count

### getValues

    public final int[] getValues()

  Returns an array of position values for each dimension.

  Returns:
    the values

### setValues

    public final void setValues(int[] values)

  Sets the position values for this coordinate.

  Parameters:
    `values` - the values

### getValueAtDimension

    public final int getValueAtDimension(int dimension)

  Gets the value at the specified (1-based) dimension.

  Parameters:
    `dimension` - the dimension
  Returns:
    the value at dimension

### setValueAtDimension

    public final void setValueAtDimension(int dimension,
                                          int value)

  Sets the value at the specified (1-based) dimension.

  Parameters:
    `dimension` - the dimension
    `value` - the value

### 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.)

  Returns:
    the product

### equals

    public boolean equals(java.lang.Object o)

  Determines whether this coordinate is equal to another. Does it have the same values?

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` - the o
  Returns:
    true, if equals

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Returns a string representing this coordinate.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the string