org.ascape.model.space
Class Coordinate2DContinuous

java.lang.Object
  extended by org.ascape.model.space.Coordinate
      extended by org.ascape.model.space.CoordinateContinuous
          extended by org.ascape.model.space.Coordinate1DContinuous
              extended by org.ascape.model.space.Coordinate2DContinuous
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
MapCoordinate

public class Coordinate2DContinuous
extends Coordinate1DContinuous

A location within a two-dimensional continuous space.

Since:
2.0
Version:
2.0
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ascape.model.space.CoordinateContinuous
values
 
Constructor Summary
Coordinate2DContinuous(double[] values)
          Creates a 2-dimensional coordinate with the specified position values.
Coordinate2DContinuous(double x, double y)
          Creates a 2-dimensional coordinate with the specified position values.
Coordinate2DContinuous(int[] intValues)
          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.
 double getYValue()
          Returns the y value of this coordinate.
 void setYValue(double 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.Coordinate1DContinuous
getValue, getXValue, setValue, setXValue
 
Methods inherited from class org.ascape.model.space.CoordinateContinuous
equals, getDimensionCount, getProduct, getValueAtDimension, getValues, setValueAtDimension, setValues
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coordinate2DContinuous

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

Parameters:
values - the values

Coordinate2DContinuous

public Coordinate2DContinuous(double x,
                              double y)
Creates a 2-dimensional coordinate with the specified position values.

Parameters:
x - the x
y - the y

Coordinate2DContinuous

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

Parameters:
intValues - the int values
Method Detail

getYValue

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

Returns:
the y value

setYValue

public void setYValue(double 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 Coordinate1DContinuous
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 Coordinate1DContinuous
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 Coordinate1DContinuous
Returns:
the string


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.