edu.brook.ascape.model
Class Coordinate2DDiscrete

java.lang.Object
  |
  +--edu.brook.ascape.model.Coordinate
        |
        +--edu.brook.ascape.model.CoordinateDiscrete
              |
              +--edu.brook.ascape.model.Coordinate1DDiscrete
                    |
                    +--edu.brook.ascape.model.Coordinate2DDiscrete

public class Coordinate2DDiscrete
extends Coordinate1DDiscrete

A location within a two dimensional space.

Since:
1.0
Version:
1.2
See Also:
Serialized Form

Fields inherited from class edu.brook.ascape.model.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
 Coordinate2DDiscrete add(Coordinate2DDiscrete coordinate)
          Adds the location of the supplied coordinate to this coordinate, returning the resulting coordinate.
 float 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 edu.brook.ascape.model.Coordinate1DDiscrete
getValue, getXValue, setValue, setXValue
 
Methods inherited from class edu.brook.ascape.model.CoordinateDiscrete
getDimensionCount, getProduct, getValueAtDimension, getValues, setValueAtDimension, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coordinate2DDiscrete

public Coordinate2DDiscrete(int[] values)
Creates a 2-dimensional coordinate with the specified position values.

Coordinate2DDiscrete

public Coordinate2DDiscrete(int x,
                            int y)
Creates a 2-dimensional coordinate with the specified position values.
Method Detail

getYValue

public final int getYValue()
Returns the y value of this coordinate.

setYValue

public final void setYValue(int y)
Sets the y value for this coordinate.

getDistance

public float getDistance(Coordinate target)
Returns the calculated distance between this coordinate and the supplied coordinate.
Parameters:
target - the coordinate to measure distance to
Overrides:
getDistance in class Coordinate1DDiscrete

add

public Coordinate2DDiscrete add(Coordinate2DDiscrete coordinate)
Adds the location of the supplied coordinate to this coordinate, returning the resulting coordinate.
Parameters:
coordinate - the coordinate to sum with this one

toString

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

(c) 1998-2000 The Brookings Insitution
Webpage