|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.maryanovsky.gwtutils.client.Point
public final class Point
A two dimensional point, with integer coordinates.
| Constructor Summary | |
|---|---|
Point()
Creates a new Point at 0,0. |
|
Point(int x,
int y)
Creates a new Point with the specified coordinates. |
|
Point(PointView point)
Creates a new Point at the same coordinates as the specified
one. |
|
Point(SizeView size)
Creates a new Point with the X coordinate at the width of
the specified size and the Y coordinate at the height of the specified
size. |
|
| Method Summary | |
|---|---|
boolean |
equals(int x,
int y)
Returns whether the specified coordinates are the same as this point's. |
boolean |
equals(Object o)
Returns whether this Point is the same as the specified one. |
boolean |
equals(PointView point)
Returns whether this Point is the same as the specified one. |
double |
getDistanceFrom(PointView point)
Returns the distance from this point to the specified one. |
double |
getDistanceFromOrigin()
Returns the distance from this point to 0,0. |
PointView |
getDistancePoint(PointView point)
Returns the distance from this point to the specified one, as a PointView. |
Point |
getDistancePoint(PointView point,
Point reusable)
Returns the distance from this point to the specified one, as a Point. |
SizeView |
getDistanceSize(PointView point)
Returns the distance from this point to the specified one, as a SizeView. |
Size |
getDistanceSize(PointView point,
Size reusable)
Returns the distance from this point to the specified one in the same manner as getDistanceSize(PointView). |
static Point |
getMidPoint(PointView point1,
PointView point2,
Point reusable)
Returns the mid-point between the two specified points. |
PointView |
getOpposite()
Returns the point opposite to this one. |
Point |
getOpposite(Point reusable)
Returns the point opposite to this one. |
int |
getX()
Returns the X coordinate. |
int |
getY()
Returns the Y coordinate. |
int |
hashCode()
Returns the hashcode of this object. |
static Point |
make(int x,
int y,
Point point)
Returns a Point with the specified coordinates. |
Point |
moveBy(int dx,
int dy)
Moves this point by the specified offsets. |
Point |
moveBy(PointView point)
Moves this point by the offsets specified by the given point. |
Point |
moveBy(SizeView size)
Moves this point by the offsets specified by the given size. |
Point |
multiplyBy(double coefficient)
Multiples the X and Y coordinates of this point by the specified coefficient. |
Point |
reflect(Point point)
Reflects this point relative to the specified one. |
Point |
roundDownToGrid(int cellWidth,
int cellHeight)
Moves this point to the nearest location with smaller X and Y coordinates which is on a grid where each cell is of the specified size. |
Point |
roundDownToGrid(SizeView cellSize)
Moves this point to the nearest location with smaller X and Y coordinates which is on a grid of the specified size. |
Point |
roundUpToGrid(int cellWidth,
int cellHeight)
Moves the point to the nearest location with greater X and Y coordinates which is on a grid where each cell is of the specified size. |
Point |
roundUpToGrid(Size cellSize)
Moves the point to the nearest location with greater X and Y coordinates which is on a grid where each cell is of the specified size. |
Point |
set(int x,
int y)
Sets both coordinates. |
Point |
set(PointView point)
Sets both coordinates. |
Point |
setX(int x)
Sets the X coordinate. |
Point |
setY(int y)
Sets the Y coordinate. |
String |
toString()
Returns a textual representation of this point. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Point(int x,
int y)
Point with the specified coordinates.
public Point()
public Point(SizeView size)
Point with the X coordinate at the width of
the specified size and the Y coordinate at the height of the specified
size.
public Point(PointView point)
Point at the same coordinates as the specified
one.
| Method Detail |
|---|
public static Point make(int x,
int y,
Point point)
Point with the specified coordinates. If the
given Point is not null, it is reused and
returned.
public Point set(int x,
int y)
this.public Point set(PointView point)
this.
public Point moveBy(int dx,
int dy)
this.public Point moveBy(PointView point)
this.public Point moveBy(SizeView size)
this.public Point multiplyBy(double coefficient)
this.public double getDistanceFromOrigin()
getDistanceFromOrigin in interface PointViewpublic double getDistanceFrom(PointView point)
getDistanceFrom in interface PointViewpublic PointView getDistancePoint(PointView point)
PointView.
getDistancePoint in interface PointView
public Point getDistancePoint(PointView point,
Point reusable)
Point. If the specified 2nd point is not null,
it is reused and returned.
getDistancePoint in interface PointViewpublic SizeView getDistanceSize(PointView point)
SizeView. Note that this may differ from
getDistancePoint(PointView) because the dimensions of a
SizeView are always non-negative.
getDistanceSize in interface PointView
public Size getDistanceSize(PointView point,
Size reusable)
null, it is reused and returned.
getDistanceSize in interface PointViewpublic PointView getOpposite()
getOpposite in interface PointViewpublic Point getOpposite(Point reusable)
null, it is reused and returned.
getOpposite in interface PointView
public Point roundDownToGrid(int cellWidth,
int cellHeight)
this.public Point roundDownToGrid(SizeView cellSize)
this.
public Point roundUpToGrid(int cellWidth,
int cellHeight)
this.public Point roundUpToGrid(Size cellSize)
this.public Point reflect(Point point)
this.
public static Point getMidPoint(PointView point1,
PointView point2,
Point reusable)
null, it is reused and
returned.
public int getX()
getX in interface PointViewpublic Point setX(int x)
this.public int getY()
getY in interface PointViewpublic Point setY(int y)
this.
public boolean equals(int x,
int y)
equals in interface PointViewpublic boolean equals(PointView point)
Point is the same as the specified one.
public boolean equals(Object o)
Point is the same as the specified one.
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||