public class NativeRectangle
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private int |
bottom
Rectangle bottom row.
|
private int |
hash
The cached hash value.
|
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.
|
NativeDimension |
dimension()
Returns the dimension of the rectangle.
|
boolean |
empty()
Check if rectangle is empty.
|
boolean |
equals(java.lang.Object o)
Test if this rectangle is equal to other object.
|
private int |
hash()
Compute the hash value, so that it can be cached.
|
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.
|
boolean |
neighbour(NativeRectangle rect)
Check if this an the other rectangle are neighbours.
|
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
private final int hash
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(java.lang.Object o)
equals in class java.lang.Objecto - the object to compare.true if objects are equal.public int hashCode()
hashCode in class java.lang.Objectpublic 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 NativeDimension dimension()
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 boolean neighbour(NativeRectangle rect)
rect - The other rectangle to check.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.Objectprivate int hash()