|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectdraw.Location
Location is an implementation of a point on the real plane.
Constructor Summary | |
Location(double x,
double y)
Constructs a new Location object. |
|
Location(Location point)
Constructs a new Location object at the location of the given Location. |
|
Location(java.awt.Point point)
Constructs a new Location object based on a Point object. |
Method Summary | |
double |
distanceTo(Location point)
Determines the distance to the given point. |
double |
getX()
Retrieves the point's x value. |
double |
getY()
Retrieves the point's y value. |
java.awt.Point |
toPoint()
Retrieves the nearest point on the integer lattice. |
java.lang.String |
toString()
Generates a string representation of the object. |
void |
translate(double dx,
double dy)
Translates the point by the given increments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Location(double x, double y)
x
- the point's x valuey
- the point's y valuepublic Location(Location point)
point
- the point to copypublic Location(java.awt.Point point)
point
- the point to copyMethod Detail |
public double getX()
public double getY()
public double distanceTo(Location point)
public java.awt.Point toPoint()
public void translate(double dx, double dy)
dx
- amount to move in x-directiondy
- amount to move in y-directionpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |