|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.maryanovsky.gwtutils.client.Rectangle
public final class Rectangle
A rectangle, in integer coordinates.
| Constructor Summary | |
|---|---|
Rectangle()
Creates a new Rectangle of 0x0 size at
0,0 coordinates. |
|
Rectangle(int x,
int y,
int width,
int height)
Creates a new Rectangle with the specified arguments. |
|
Rectangle(PointView point,
SizeView size)
Creates a new rectangle at the specified coordinates and with the specified size. |
|
Rectangle(RectangleView rectangle)
Creates a new rectangle with the same values as the specified one. |
|
| Method Summary | |
|---|---|
boolean |
contains(PointView point)
Returns whether this rectangle contains the specified point. |
boolean |
contains(RectangleView rectangle)
Returns whether this rectangle contains the specified one. |
boolean |
equals(int x,
int y,
int width,
int height)
Returns whether the coordinates and size of this rectangle are the specified ones. |
boolean |
equals(Object o)
Returns whether this Rectangle object has the same
coordinates and size as this one. |
boolean |
equals(RectangleView rect)
Returns whether the specified rectangle is the same as this one. |
Rectangle |
expandToGrid(int cellWidth,
int cellHeight)
Expands this rectangle so that it lies on the grid with cells of the specified size. |
Rectangle |
expandToGrid(SizeView cellSize)
Expands this rectangle so that it lies on the grid with cells of the specified size. |
PointView |
getBottomLeft()
Returns the location of the bottom-left point. |
Point |
getBottomLeft(Point reusable)
Returns the location of the bottom-left point of the rectangle. |
PointView |
getBottomRight()
Returns the location of the bottom-right point. |
Point |
getBottomRight(Point reusable)
Returns the location of the bottom-right point of the rectangle. |
PointView |
getCenter()
Returns the location of the center of the rectangle. |
Point |
getCenter(Point reusable)
Returns the location of the center of the rectangle, in the same manner as the getCenter() method. |
int |
getHeight()
Returns the height of the rectangle. |
SizeView |
getSize()
Returns the size of the rectangle. |
Size |
getSize(Size reusable)
Returns the size of the rectangle. |
PointView |
getTopLeft()
Returns the location of the top-left point. |
Point |
getTopLeft(Point reusable)
Returns the location of the top-left point of the rectangle. |
PointView |
getTopRight()
Returns the location of the top-right point. |
Point |
getTopRight(Point reusable)
Returns the location of the top-right point of the rectangle. |
int |
getWidth()
Returns the width of the rectangle. |
int |
getX()
Returns the X coordinate of the top-left point. |
int |
getY()
Returns the Y coordinate of the top-left point. |
Rectangle |
growBy(int dx,
int dy)
Grows the dimensions of the rectangle by the specified values. |
Rectangle |
growBy(PointView point)
Grows the dimensions of the rectangle by the values of the specified point. |
Rectangle |
growBy(SizeView size)
Grows the dimensions of the rectangle by the specified size. |
int |
hashCode()
Returns the hashcode of this object. |
boolean |
intersects(RectangleView rectangle)
Returns whether this rectangle intersects with the specified one. |
static Rectangle |
make(int x,
int y,
int width,
int height,
Rectangle reusable)
Returns a Rectangle with the specified values. |
static Rectangle |
makeCover(PointView point1,
PointView point2)
Returns the smallest rectangle which contains both specified points. |
Rectangle |
moveBy(int dx,
int dy)
Moves the rectangle by the specified offsets. |
Rectangle |
moveBy(PointView point)
Moves the rectangle by the offsets specified by the given point. |
Rectangle |
moveBy(SizeView size)
Moves the rectangle by the offsets specified by the given size. |
Rectangle |
multiplyBy(double coefficient)
Multiplies the coordinates and dimensions of this rectangle by the specified coefficient. |
Rectangle |
set(int x,
int y,
int width,
int height)
Sets the values of this rectangle. |
Rectangle |
setCover(PointView point1,
PointView point2)
Sets this rectangle to the smallest rectangle which contains both specified points. |
Rectangle |
setHeight(int height)
Sets the height of the rectangle. |
Rectangle |
setSize(int width,
int height)
Sets the size of the rectangle. |
Rectangle |
setSize(SizeView size)
Sets the size of the rectangle. |
Rectangle |
setTopLeft(int x,
int y)
Sets the location of the top-left point. |
Rectangle |
setTopLeft(PointView point)
Sets the location of the top-left point. |
Rectangle |
setWidth(int width)
Sets the width of the rectangle. |
Rectangle |
setX(int x)
Sets the X coordinate of the top-left point. |
Rectangle |
setY(int y)
Sets the Y coordinate of the top-left point. |
String |
toString()
Returns a textual representation of this rectangle. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Rectangle(int x,
int y,
int width,
int height)
Rectangle with the specified arguments.
Note that if width and/or height are negative,
the rectangle is normalized (the top-left point is moved accordingly, and
and the width and/or height are set to the absolute values of the
specified ones).
x - The X coordinate of the top-left point.y - The Y coordinate of the top-left point.width - The width of the rectangle.height - The height of the rectangle.public Rectangle()
Rectangle of 0x0 size at
0,0 coordinates.
public Rectangle(RectangleView rectangle)
public Rectangle(PointView point,
SizeView size)
| Method Detail |
|---|
public static Rectangle make(int x,
int y,
int width,
int height,
Rectangle reusable)
Rectangle with the specified values. If the given
Rectangle is not null, it is reused and
returned.
public static Rectangle makeCover(PointView point1,
PointView point2)
public Rectangle set(int x,
int y,
int width,
int height)
this.public SizeView getSize()
getSize in interface RectangleViewpublic Size getSize(Size reusable)
Size
object is not null, it is reused and returned.
getSize in interface RectangleView
public Rectangle setSize(int width,
int height)
this.public Rectangle setSize(SizeView size)
this.public PointView getTopLeft()
getTopLeft in interface RectangleViewpublic Point getTopLeft(Point reusable)
Point object is not null, it is
reused and returned.
getTopLeft in interface RectangleViewpublic PointView getTopRight()
getTopRight in interface RectangleViewpublic Point getTopRight(Point reusable)
Point object is not null, it is
reused and returned.
getTopRight in interface RectangleViewpublic PointView getBottomLeft()
getBottomLeft in interface RectangleViewpublic Point getBottomLeft(Point reusable)
Point object is not null, it is
reused and returned.
getBottomLeft in interface RectangleViewpublic PointView getBottomRight()
getBottomRight in interface RectangleViewpublic Point getBottomRight(Point reusable)
Point object is not null, it is
reused and returned.
getBottomRight in interface RectangleViewpublic PointView getCenter()
getCenter in interface RectangleViewpublic Point getCenter(Point reusable)
Point object is not null, it is reused and
returned.
getCenter in interface RectangleView
public Rectangle setTopLeft(int x,
int y)
this.public Rectangle setTopLeft(PointView point)
this.
public Rectangle moveBy(int dx,
int dy)
this.public Rectangle moveBy(SizeView size)
this.public Rectangle moveBy(PointView point)
this.
public Rectangle growBy(int dx,
int dy)
this.public Rectangle growBy(SizeView size)
this.public Rectangle growBy(PointView point)
public Rectangle multiplyBy(double coefficient)
this.
public Rectangle setCover(PointView point1,
PointView point2)
this.public boolean contains(PointView point)
contains in interface RectangleViewpublic boolean contains(RectangleView rectangle)
contains in interface RectangleViewpublic boolean intersects(RectangleView rectangle)
intersects in interface RectangleView
public Rectangle expandToGrid(int cellWidth,
int cellHeight)
this.public Rectangle expandToGrid(SizeView cellSize)
this.public int getX()
getX in interface RectangleViewpublic Rectangle setX(int x)
this.public int getY()
getY in interface RectangleViewpublic Rectangle setY(int y)
this.public int getWidth()
getWidth in interface RectangleViewpublic Rectangle setWidth(int width)
this.public int getHeight()
getHeight in interface RectangleViewpublic Rectangle setHeight(int height)
this.
public boolean equals(int x,
int y,
int width,
int height)
public boolean equals(RectangleView rect)
public boolean equals(Object o)
Rectangle object has the same
coordinates and size as this 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 | ||||||||