Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ascape.model.space
Class Coordinate2DDiscrete

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

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

    public class Coordinate2DDiscrete

extends Coordinate1DDiscrete

A location within a two-dimensional discrete space.

Since:
  1.0
Version:
  1.2
Author:
  Miles Parker
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.ascape.model.space.CoordinateDiscrete
`values`

Constructor Summary
`Coordinate2DDiscrete(int[] values)` Creates a 2-dimensional coordinate with the specified position values.
`Coordinate2DDiscrete(int x, int y)` Creates a 2-dimensional coordinate with the specified position values.

Method Summary
`Coordinate` | `add(Coordinate coordinate)` Adds the location of the supplied coordinate to this coordinate, returning the resulting coordinate.
`double` | `getDistance(Coordinate target)` Returns the calculated distance between this coordinate and the supplied coordinate.
`int` | `getYValue()` Returns the y value of this coordinate.
`void` | `setYValue(int y)` Sets the y value for this coordinate.
`java.lang.String` | `toString()` Returns a string representing this coordinate.

Methods inherited from class org.ascape.model.space.Coordinate1DDiscrete
`getValue, getXValue, setValue, setXValue`

Methods inherited from class org.ascape.model.space.CoordinateDiscrete
`equals, getDimensionCount, getProduct, getValueAtDimension, getValues, hashCode, setValueAtDimension, setValues`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Coordinate2DDiscrete

    public Coordinate2DDiscrete(int[] values)

  Creates a 2-dimensional coordinate with the specified position values.

  Parameters:
    `values` - the values

### Coordinate2DDiscrete

    public Coordinate2DDiscrete(int x,
                                int y)

  Creates a 2-dimensional coordinate with the specified position values.

  Parameters:
    `x` - the x
    `y` - the y

Method Detail

### getYValue

    public final int getYValue()

  Returns the y value of this coordinate.

  Returns:
    the y value

### setYValue

    public final void setYValue(int y)

  Sets the y value for this coordinate.

  Parameters:
    `y` - the y

### getDistance

    public double getDistance(Coordinate target)

  Returns the calculated distance between this coordinate and the supplied coordinate. Note: Expects non-periodic (i.e. not non-wrap around) space, since there is no space context. Coordinates are not aware of a particular space context, so the agent and space getDistance methods should be used whenever comparing distance in the context of scapes.

  Overrides:
    `getDistance` in class `Coordinate1DDiscrete`
  Parameters:
    `target` - the location to calculate distance to
  Returns:
    the distance between the two coordinates

### add

    public Coordinate add(Coordinate coordinate)

  Adds the location of the supplied coordinate to this coordinate, returning the resulting coordinate.

  Overrides:
    `add` in class `Coordinate1DDiscrete`
  Parameters:
    `coordinate` - the coordinate to sum with this one
  Returns:
    the coordinate

### toString

    public java.lang.String toString()

  Returns a string representing this coordinate.

  Overrides:
    `toString` in class `Coordinate1DDiscrete`
  Returns:
    the string

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD