public class NativeRectangle
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
bottom
Rectangle bottom row.
|
private int |
left
Rectangle left column.
|
private int |
right
Rectangle right column.
|
private int |
top
Rectangle top row.
|
Constructor and Description |
---|
NativeRectangle(int top,
int left,
int bottom,
int right)
Constructor.
|
NativeRectangle(NativePoint topleft,
NativeDimension size)
Constructor.
|
NativeRectangle(NativeRectangle rect)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
area()
Compute the area of this rectangle.
|
int |
bottom()
Get bottom coordinate of this rectangle.
|
boolean |
contains(int x,
int y)
Returns
true if the specified point is inside this
rectangle. |
boolean |
contains(NativePoint p)
Returns
true if the specified point is inside this
rectangle. |
boolean |
contains(NativeRectangle r)
Returns
true is specified rectangle is completely inside
this rectangle. |
java.util.List<NativeRectangle> |
difference(NativeRectangle rect,
int baseUnit)
Create new rectangles which is the difference between this and the specified rectangle.
|
boolean |
empty()
Check if rectangle is empty.
|
boolean |
equals(NativeRectangle rect)
Check if this rectangle is equal to specified one.
|
int |
hashCode()
Compute the hashcode of this rectangle.
|
int |
height()
Returns the rectangle's height.
|
NativeRectangle |
intersection(NativeRectangle rect)
Calculate rectangle which is intersection between this and specified
rectangle.
|
boolean |
intersects(NativeRectangle rect)
Check if this and specified rectangle have intersection.
|
int |
left()
Get left coordinate of this rectangle.
|
int |
right()
Get right coordinate of this rectangle.
|
int |
top()
Get top coordinate of this rectangle.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
NativeRectangle |
translate(int dx,
int dy)
Create new rectangle which is translated by specified offset.
|
NativeRectangle |
translate(NativePoint p)
Create new rectangle which is translated by specified offset.
|
NativeRectangle |
union(NativeRectangle rect)
Create new rectangle which is a union of this and specified rectangle.
|
int |
width()
Returns the rectangle's width.
|
private final int bottom
private final int left
private final int right
private final int top
public NativeRectangle(int top, int left, int bottom, int right)
top
- Top row.left
- Left column.bottom
- Bottom row.right
- Right column.public NativeRectangle(NativePoint topleft, NativeDimension size)
topleft
- Top-left corner.size
- Rectangle dimension.public NativeRectangle(NativeRectangle rect)
rect
- Source rectangle.public int bottom()
public boolean contains(int x, int y)
true
if the specified point is inside this
rectangle.x
- X coordinate.y
- Y coordinate.true
if coordinates are inside rectangle.public boolean contains(NativePoint p)
true
if the specified point is inside this
rectangle.p
- Point to check.true
if specified point is inside rectangle.public boolean contains(NativeRectangle r)
true
is specified rectangle is completely inside
this rectangle.r
- Rectangle to check.true
if specified rectangle is inside this
rectangle.public boolean empty()
true
if rectangle is empty.public boolean equals(NativeRectangle rect)
rect
- Rectangle to check.true
if rectangles are equal.public int hashCode()
hashCode
in class java.lang.Object
public NativeRectangle intersection(NativeRectangle rect)
rect
- Source rectangle.null
if there is no intersection.public boolean intersects(NativeRectangle rect)
rect
- Source rectangle.true
if rectangles have intersection.public int left()
public int right()
public int top()
public NativeRectangle translate(int dx, int dy)
dx
- Delta X.dy
- Delta Y.public NativeRectangle translate(NativePoint p)
p
- Offset represented as a point.public NativeRectangle union(NativeRectangle rect)
rect
- Source rectangle.public java.util.List<NativeRectangle> difference(NativeRectangle rect, int baseUnit)
rect
- Removed rectangle.baseUnit
- The base measurement unit.public int area()
public int width()
public int height()
public java.lang.String toString()
toString
in class java.lang.Object