public class Rectangle
extends java.lang.Object
Constructor and Description |
---|
Rectangle(int x,
int y,
int width,
int height) |
Modifier and Type | Method and Description |
---|---|
boolean |
borders(Rectangle aRectangle)
Return
true if this Rectangle borders the specified rectangle along either its
horizontal or vertical axis. |
boolean |
bordersHorizontal(Rectangle aRectangle)
Return
true if this Rectangle borders the specified rectangle along its horizontal
axis. |
boolean |
bordersHorizontalStrict(Rectangle aRectangle)
Return
true if this Rectangle borders the specified rectangle along its horizontal
axis. |
boolean |
bordersStrict(Rectangle aRectangle)
Return
true if this Rectangle borders the specified rectangle along either its
horizontal or vertical axis. |
boolean |
bordersVertical(Rectangle aRectangle)
Return
true if this Rectangle borders the specified rectangle along its vertical
axis. |
boolean |
bordersVerticalStrict(Rectangle aRectangle)
Return
true if this Rectangle borders the specified rectangle along its vertical
axis. |
java.lang.Object |
clone()
Create a copy of this Rectangle.
|
boolean |
contains(int aiX,
int aiY)
Checks whether or not this
Rectangle contains the
point at the specified location. |
boolean |
contains(int aiX,
int aiY,
int aiWidth,
int aiHeight)
Checks whether or not this rectangle entirely contains the specified rectangle.
|
boolean |
contains(Rectangle aRectangle)
Checks whether or not this rectangle entirely contains the specified rectangle.
|
boolean |
equals(java.lang.Object aObject)
Checks whether two rectangles are equal.
|
int |
getBottom()
Return the index of the bottom of the rectangle.
|
int |
getRight()
Return the index of the right side of the rectangle.
|
Rectangle |
intersection(Rectangle aRectangle)
Computes the intersection of this
Rectangle with the specified
Rectangle . |
boolean |
intersects(Rectangle aRectangle)
Determines whether or not this
Rectangle and the specified
Rectangle intersect. |
boolean |
isColumnSpecification()
Return an indication of whether this is column-only specification.
|
boolean |
isRowSpecification()
Return an indication of whether this is row-only specification.
|
Rectangle[] |
removeHorizontal(Rectangle aRectangle)
Return the result of the removal of a specified rectangle from this rectangle.
|
Rectangle[] |
removeVertical(Rectangle aRectangle)
Return the result of the removal of a specified rectangle from this rectangle.
|
void |
setLocation(int aiX,
int aiY)
Sets the location of this rectangle to the specified X/Y coordinates.
|
void |
setSize(int aiWidth,
int aiHeight)
Sets the size of this rectangle to the specified width and height.
|
java.lang.String |
toString()
Returns a
String representing this Rectangle and its values. |
Rectangle |
union(Rectangle aRectangle)
Computes the union of this
Rectangle with the specified Rectangle . |
public boolean borders(Rectangle aRectangle)
true
if this Rectangle borders the specified rectangle along either its
horizontal or vertical axis.aRectangle
- Rectangle to compare to this one.true
if this Rectangle borders the specified rectangle along either axis.public boolean bordersVertical(Rectangle aRectangle)
true
if this Rectangle borders the specified rectangle along its vertical
axis.aRectangle
- Rectangle to compare to this one.true
if this Rectangle borders the specified rectangle along vertical axis.public boolean bordersHorizontal(Rectangle aRectangle)
true
if this Rectangle borders the specified rectangle along its horizontal
axis.aRectangle
- Rectangle to compare to this one.true
if this Rectangle borders the specified rectangle along horizontal axis.public boolean bordersStrict(Rectangle aRectangle)
true
if this Rectangle borders the specified rectangle along either its
horizontal or vertical axis. The rectangles must also be of the same width or height such
that combining the two would form a perfect rectangle.aRectangle
- Rectangle to compare to this one.true
if this Rectangle borders the specified rectangle along either axis.public boolean bordersVerticalStrict(Rectangle aRectangle)
true
if this Rectangle borders the specified rectangle along its vertical
axis. Note that both rectangles must also be of the same y position and width.aRectangle
- Rectangle to compare to this one.true
if this Rectangle borders the specified rectangle along vertical axis.public boolean bordersHorizontalStrict(Rectangle aRectangle)
true
if this Rectangle borders the specified rectangle along its horizontal
axis. Note that both rectangles must also be of the same x position and width.aRectangle
- Rectangle to compare to this one.true
if this Rectangle borders the specified rectangle along horizontal axis.public java.lang.Object clone()
clone
in class java.lang.Object
public boolean contains(int aiX, int aiY)
Rectangle
contains the
point at the specified location.aiX
- The specified x coordinate.aiY
- The specified y coordinate.true
if this rectangle contains the specified point.public boolean contains(int aiX, int aiY, int aiWidth, int aiHeight)
aiX
- The X coordinate.aiY
- The Y coordinate.aiWidth
- The width of the rectangle.aiHeight
- The height of the rectangle.true
if this Rectangle entirely contains the specified rectangle.public boolean contains(Rectangle aRectangle)
aRectangle
- The specified rectangle to test.true
if this Rectangle entirely contains the specified rectangle.public int getBottom()
public int getRight()
public Rectangle intersection(Rectangle aRectangle)
Rectangle
with the specified
Rectangle
. Returns a new Rectangle
that represents the
intersection of the two rectangles. If the two rectangles do not intersect, the result will be
an empty rectangle.aRectangle
- The specified Rectangle
Rectangle
contained in both the specified
Rectangle
and in this Rectangle
; or if the rectangles do not
intersect, an empty rectangle.public boolean intersects(Rectangle aRectangle)
Rectangle
and the specified
Rectangle
intersect. Two rectangles intersect if
their intersection is non-empty.aRectangle
- the specified Rectangle
true
if the specified Rectangle
and this
Rectangle
intersect; false
otherwise.public boolean isColumnSpecification()
true
if this rectangle is a column-only specification.public boolean isRowSpecification()
true
if this rectangle is a row-only specification.public void setLocation(int aiX, int aiY)
aiX
- X coordinate for rectangle.aiY
- Y coordinate for rectangle.public Rectangle[] removeVertical(Rectangle aRectangle)
null
if the specified rectangle completely engulfs this rectangle.aRectangle
- Rectangle to be removed.null
.public Rectangle[] removeHorizontal(Rectangle aRectangle)
null
if the specified rectangle completely engulfs this rectangle.aRectangle
- Rectangle to be removed.null
.public void setSize(int aiWidth, int aiHeight)
aiWidth
- the new width for this rectangle.aiHeight
- the new height for this rectangle.public Rectangle union(Rectangle aRectangle)
Rectangle
with the specified Rectangle
.
Returns a new Rectangle
that represents the union of the two rectanglesaRectangle
- the specified Rectangle
Rectangle
containing both the specified
Rectangle
and this Rectangle
.public boolean equals(java.lang.Object aObject)
true
if and only if the argument is not
null
and is a Rectangle
object that has the
same top-left corner, width, and height as this Rectangle
.equals
in class java.lang.Object
aObject
- the Object
to compare with this Rectangle
true
if the objects are equal; false
otherwise.public java.lang.String toString()
String
representing this Rectangle
and its values.toString
in class java.lang.Object
String
representing this Rectangle
object's coordinate and size values.Copyright © 2005-2016 Progress Software Corporation and/or its subsidiaries and affiliates. All rights reserved.