org.ascape.model.space
Class Coordinate1DDiscrete

java.lang.Object
  extended by org.ascape.model.space.Coordinate
      extended by org.ascape.model.space.CoordinateDiscrete
          extended by org.ascape.model.space.Coordinate1DDiscrete
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Coordinate2DDiscrete

public class Coordinate1DDiscrete
extends CoordinateDiscrete

A location within a one-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
Coordinate1DDiscrete()
          Creates a 1-dimensional coordinate.
Coordinate1DDiscrete(int value)
          Creates a 1-dimensional coordinate with the specified position.
Coordinate1DDiscrete(int[] values)
          Creates a 1-dimensional coordinate with the specified postion values.
 
Method Summary
 Coordinate add(Coordinate coordinate)
          Adds the location of the supplied coordinate to this coordinate, returning the resulting coordinate.
 double getDistance(Coordinate coordinate)
          Returns the distance between two coordinates.
 int getValue()
          Returns the number of dimensions for this lattice.
 int getXValue()
          Returns the x value of this coordinate.
 void setValue(int x)
          Sets the value for this coordinate.
 void setXValue(int x)
          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.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

Coordinate1DDiscrete

public Coordinate1DDiscrete()
Creates a 1-dimensional coordinate.


Coordinate1DDiscrete

public Coordinate1DDiscrete(int[] values)
Creates a 1-dimensional coordinate with the specified postion values.

Parameters:
values - the values

Coordinate1DDiscrete

public Coordinate1DDiscrete(int value)
Creates a 1-dimensional coordinate with the specified position.

Parameters:
value - the value
Method Detail

getDistance

public double getDistance(Coordinate coordinate)
Returns the distance between two coordinates. 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.

Specified by:
getDistance in class Coordinate
Parameters:
coordinate - target to calcualte distance to
Returns:
the distance between the two coordinates

getValue

public final int getValue()
Returns the number of dimensions for this lattice.

Returns:
the value

setValue

public final void setValue(int x)
Sets the value for this coordinate.

Parameters:
x - the x

getXValue

public final int getXValue()
Returns the x value of this coordinate.

Returns:
the x value

setXValue

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

Parameters:
x - the x

add

public Coordinate add(Coordinate coordinate)
Adds the location of the supplied coordinate to this coordinate, returning the resulting coordinate.

Specified by:
add in class Coordinate
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 CoordinateDiscrete
Returns:
the string


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