|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectobjectdraw.Location
public class 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 copy of a Location object. |
|
Location(Point point)
Constructs a new Location object based on a Point object. |
Method Summary | |
---|---|
double |
distanceTo(Location point)
Determines the distance to the given Location. |
boolean |
equals(Object obj)
Compares Location to another object |
double |
getX()
Retrieves the Location's x coordinate. |
double |
getY()
Retrieves the Location's y coordinate. |
int |
hashCode()
Generates a hashCode for a Location |
Point |
toPoint()
Retrieves the nearest point with integer coordinates as a Point. |
String |
toString()
Generates a string representation of the Location. |
void |
translate(double dx,
double dy)
Translates the Location by the given increments. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, 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 Location to copypublic Location(Point point)
point
- the point to copyMethod Detail |
---|
public double distanceTo(Location point)
public boolean equals(Object obj)
equals
in class Object
public double getX()
public double getY()
public int hashCode()
hashCode
in class Object
public Point toPoint()
public String toString()
toString
in class Object
public void translate(double dx, double dy)
dx
- amount to translate in x-directiondy
- amount to translate in y-direction
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |