|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectPoint2D
Point
GridCoordinates2D
public class GridCoordinates2D
Holds the set of two-dimensional grid coordinates that specifies the location of the
grid point within the grid. This class extends
Point
for interoperability with Java2D.
GeneralGridCoordinates
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class Point2D |
---|
Point2D.Double, Point2D.Float |
Field Summary |
---|
Fields inherited from class Point |
---|
x, y |
Constructor Summary | |
---|---|
GridCoordinates2D()
Creates an initially empty grid coordinates. |
|
GridCoordinates2D(int x,
int y)
Creates a grid coordinates initialized to the specified values. |
|
GridCoordinates2D(Point coordinates)
Creates a grid coordinates initialized to the specified point. |
Method Summary | |
---|---|
GridCoordinates2D |
clone()
Returns a clone of this coordinates. |
int |
getCoordinateValue(int dimension)
Returns the coordinate value at the specified dimension. |
int[] |
getCoordinateValues()
Returns one integer value for each dimension of the grid. |
int |
getDimension()
Returns the number of dimensions, which is always 2. |
void |
setCoordinateValue(int dimension,
int value)
Sets the coordinate value at the specified dimension. |
String |
toString()
Returns a string representation of this grid coordinates. |
Methods inherited from class Point |
---|
equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translate |
Methods inherited from class Point2D |
---|
distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation |
Methods inherited from class Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GridCoordinates2D()
public GridCoordinates2D(int x, int y)
x
- The x coordinate value.y
- The y coordinate value.public GridCoordinates2D(Point coordinates)
coordinates
- The coordinate values to copy.Method Detail |
---|
public final int getDimension()
getDimension
in interface GridCoordinates
public int[] getCoordinateValues()
getCoordinateValues
in interface GridCoordinates
GridCoordinates
object.public int getCoordinateValue(int dimension) throws IndexOutOfBoundsException
getCoordinateValues()[i]
. It is provided for
efficienty.
getCoordinateValue
in interface GridCoordinates
dimension
- The dimension from 0 inclusive to getDimension()
exclusive.
IndexOutOfBoundsException
- if the specified dimension is out of bounds.public void setCoordinateValue(int dimension, int value) throws IndexOutOfBoundsException, UnsupportedOperationException
setCoordinateValue
in interface GridCoordinates
dimension
- The index of the value to set.value
- The new value.
IndexOutOfBoundsException
- if the specified dimension is out of bounds.
UnsupportedOperationException
- if this grid coordinates is not modifiable.public String toString()
toString
in class Point
public GridCoordinates2D clone()
clone
in class Point2D
Object.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |