|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Point
This class represents a Point
as an x,y pair.
Field Summary | |
double |
x
Holds the x coordinate. |
double |
y
Holds the y coordinate. |
Constructor Summary | |
Point()
Default class constructor creates a point at the origin. |
|
Point(double x,
double y)
Class constructor creates a point at the given coordinate. |
Method Summary | |
void |
assign(double x,
double y)
Assigns the value of coordinates x and y
to this point. |
void |
assign(Point pt)
Assigns the value of pt to this point. |
double |
distance()
Returns the distance of the point from the origin. |
double |
distance(Point pt)
Returns the distance of pt from this point. |
java.lang.String |
toString()
Method used by Java to convert from Point to
string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public double x
public double y
Constructor Detail |
public Point()
x
- The x cooridinate.y
- The y cooridinate.public Point(double x, double y)
x
- The x cooridinate.y
- The y cooridinate.Method Detail |
public double distance()
public double distance(Point pt)
pt
from this point.pt
from this point.public void assign(double x, double y)
x
and y
to this point.public void assign(Point pt)
pt
to this point.public java.lang.String toString()
Point
to
string. Useful when debugging.toString
in class java.lang.Object
Point
.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |