|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.savarese.spatial.GenericPoint<Coord>
public class GenericPoint<Coord extends java.lang.Comparable<? super Coord>>
A Point implementation supporting k dimensions.
Constructor Summary | |
---|---|
GenericPoint(Coord x,
Coord y)
Two-dimensional convenience constructor. |
|
GenericPoint(Coord x,
Coord y,
Coord z)
Three-dimensional convenience constructor. |
|
GenericPoint(Coord x,
Coord y,
Coord z,
Coord w)
Four-dimensional convenience constructor. |
|
GenericPoint(int dimensions)
Constructs a GenericPoint with the specified dimensions. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a copy of the point. |
boolean |
equals(java.lang.Object obj)
Returns true if the specified object is equal to the GenericPoint. |
Coord |
getCoord(int dimension)
Returns the value of the coordinate for the specified dimension. |
int |
getDimensions()
Returns the number of dimensions of the point. |
int |
hashCode()
Returns the hash code value for this point. |
void |
setCoord(int dimension,
Coord value)
Sets the value of the coordinate for the specified dimension. |
java.lang.String |
toString()
Returns a string representation of the point, listing its coordinate values in order. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GenericPoint(int dimensions)
dimensions
- The number of dimensions in the point. Must be
greater than 0.public GenericPoint(Coord x, Coord y)
x
- The coordinate value of the first dimension.y
- The coordinate value of the second dimension.public GenericPoint(Coord x, Coord y, Coord z)
x
- The coordinate value of the first dimension.y
- The coordinate value of the second dimension.z
- The coordinate value of the third dimension.public GenericPoint(Coord x, Coord y, Coord z, Coord w)
x
- The coordinate value of the first dimension.y
- The coordinate value of the second dimension.z
- The coordinate value of the third dimension.w
- The coordinate value of the fourth dimension.Method Detail |
---|
public void setCoord(int dimension, Coord value) throws java.lang.ArrayIndexOutOfBoundsException
dimension
- The dimension (starting from 0) of the
coordinate value to set.value
- The new value of the coordinate.
java.lang.ArrayIndexOutOfBoundsException
- If the dimension is
outside of the range [0,getDimensions()-1].public Coord getCoord(int dimension)
getCoord
in interface Point<Coord extends java.lang.Comparable<? super Coord>>
dimension
- The dimension (starting from 0) of the
coordinate value to retrieve.
java.lang.ArrayIndexOutOfBoundsException
- If the dimension is
outside of the range [0,getDimensions()-1].public int getDimensions()
getDimensions
in interface Point<Coord extends java.lang.Comparable<? super Coord>>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to test for equality.
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |