|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.slides.items.Point
public class Point
Class Point provides an (x,y) point on a slide. Operations are provided for doing arithmetic on points.
A point is used to specify the location of a SlideItem
. Class Point also keeps track of the "last point."
When a slide item is created, its location is stored as the last point; see
the documentation for the various slide items for more information. The
static Point.last() method returns the last point; combined with
point arithmetic, this can be used to position the next slide item relative
to the previous slide item.
Constructor Summary | |
---|---|
Point()
Construct a new point at location (0,0). |
|
Point(double x,
double y)
Construct a new point at location (x,y). |
|
Point(Point thePoint)
Construct a new point at the same location as the given point. |
Method Summary | |
---|---|
Point |
add(double dx,
double dy)
Returns a new point at the given offsets from this point. |
Point |
add(Size theSize)
Returns a new point at the given width and height away from this point. |
Point |
e(double distance)
Returns a new point that is the given distance east of this point. |
Point |
e(Size theSize)
Returns a new point that is the given distance east of this point. |
boolean |
equals(Object obj)
Determine if this point is equal to the given object. |
int |
hashCode()
Returns a hash code for this point. |
static Point |
last()
Returns the last point. |
Point |
n(double distance)
Returns a new point that is the given distance north of this point. |
Point |
n(Size theSize)
Returns a new point that is the given distance north of this point. |
void |
readExternal(ObjectInput in)
Read this point from the given object input stream. |
Point |
s(double distance)
Returns a new point that is the given distance south of this point. |
Point |
s(Size theSize)
Returns a new point that is the given distance south of this point. |
Point |
sub(double dx,
double dy)
Returns a new point at the given offsets from this point. |
Point |
sub(Size theSize)
Returns a new point at the given width and height away from this point. |
String |
toString()
Returns a string version of this point. |
Point |
w(double distance)
Returns a new point that is the given distance west of this point. |
Point |
w(Size theSize)
Returns a new point that is the given distance east of this point. |
void |
writeExternal(ObjectOutput out)
Write this point to the given object output stream. |
double |
x()
Returns this point's X coordinate. |
double |
y()
Returns this point's Y coordinate. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Point()
public Point(double x, double y)
x
- X coordinate.y
- Y coordinate.public Point(Point thePoint)
thePoint
- Point to copy.Method Detail |
---|
public static Point last()
public double x()
public double y()
public Point add(double dx, double dy)
dx
- X offset; added to this point's X coordinate.dy
- Y offset; added to this point's Y coordinate.public Point add(Size theSize)
theSize
- Size object containing width and height.public Point sub(double dx, double dy)
dx
- X offset; subtracted from this point's X coordinate.dy
- Y offset; subtracted from this point's Y coordinate.public Point sub(Size theSize)
theSize
- Size object containing width and height.public Point n(double distance)
distance
- Distance of new point from this point.public Point s(double distance)
distance
- Distance of new point from this point.public Point e(double distance)
distance
- Distance of new point from this point.public Point w(double distance)
distance
- Distance of new point from this point.public Point n(Size theSize)
theSize
- Distance of new point from this point =
theSize.height().public Point s(Size theSize)
theSize
- Distance of new point from this point =
theSize.height().public Point e(Size theSize)
theSize
- Distance of new point from this point =
theSize.width().public Point w(Size theSize)
theSize
- Distance of new point from this point =
theSize.width().public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- Object output stream.
IOException
- Thrown if an I/O error occurred.public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
in
- Object input stream.
IOException
- Thrown if an I/O error occurred.public boolean equals(Object obj)
equals
in class Object
obj
- Object to test.
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |