|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Point
A representation of a point in N-dimensional space. In the current implementation N == 3.
Constructor Summary | |
Point(int x,
int y,
int z)
Create a point in 3 dimensional space given three integers Requires: MAX_DIM == 3 |
|
Point(java.lang.String s)
Create a new point given a string with MAX_DIM integers on it |
Method Summary | |
double |
distanceFrom(Point p)
Calculate the distance of this point from point p Requires: p must not be null. |
double |
get(int i)
Return the value in the ith dimension of this point Requires: 0 <= i < MAX_DIM |
boolean |
sameDimension(Point p,
int k)
Returns true if this point has the same value in dimension k as point p. |
java.lang.String |
toString()
Construct the string representation of a Point: a list of the values in for each dimension. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Point(java.lang.String s)
s
- A string containing MAX_DIM integerspublic Point(int x, int y, int z)
x
- y
- z
- Method Detail |
public double get(int i)
i
- the dimension
public double distanceFrom(Point p)
p
- The point to get the distance from
public boolean sameDimension(Point p, int k)
p
- The point to compare.k
- The dimension of interest.
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 |