ewe.fx
Class Rect

java.lang.Object
  extended byewe.fx.Rect
All Implemented Interfaces:
Area, Cloneable, Encodable

public class Rect
extends Object
implements Cloneable, Area, Encodable

Rect is a rectangle.


Field Summary
static Rect buff
           
 int height
          rectangle height
 int width
          rectangle width
 int x
          x position
 int y
          y position
 
Constructor Summary
Rect()
           
Rect(Dimension d)
           
Rect(int x, int y, int width, int height)
          Constructs a rectangle with the given x, y, width and height.
 
Method Summary
 boolean equals(Object other)
          Returns if this object is considered equal to the other object.
 Rect getAddition(Rect r2, Rect dest)
           
 Rect getIntersection(Rect r, Rect dest)
          Get the intersection between this Rect and another Rect.
 Rect getRect(Rect dest)
          Get the bounding rectangle of the area.
 boolean intersects(Area other)
          See if this Area intersects another.
 boolean intersects(Rect r)
           
 boolean isIn(int x, int y)
          Check if the point is in the area.
 boolean isInside(int x, int y)
           
 Rect set(int x, int y, int w, int h)
           
 Rect set(Rect r)
           
 Rect setCorners(int x1, int y1, int x2, int y2)
           
 String toString()
          Return a String representation of this object.
 void unionWith(Rect other)
           
static Rect unNull(Rect r)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode
 

Field Detail

x

public int x
x position


y

public int y
y position


width

public int width
rectangle width


height

public int height
rectangle height


buff

public static Rect buff
Constructor Detail

Rect

public Rect(int x,
            int y,
            int width,
            int height)
Constructs a rectangle with the given x, y, width and height.


Rect

public Rect()

Rect

public Rect(Dimension d)
Method Detail

set

public Rect set(Rect r)

set

public Rect set(int x,
                int y,
                int w,
                int h)

unNull

public static Rect unNull(Rect r)

toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Overrides:
toString in class Object
Returns:
a String representing this object.

intersects

public boolean intersects(Rect r)

unionWith

public void unionWith(Rect other)

getIntersection

public Rect getIntersection(Rect r,
                            Rect dest)
Get the intersection between this Rect and another Rect.

Parameters:
r - The other Rect.
dest - The destination for the intersection Rect values. This can be either this Rect or the "r" Rect or it can be null.
Returns:
The dest rect or a new Rect if dest is null.

getAddition

public Rect getAddition(Rect r2,
                        Rect dest)

isInside

public boolean isInside(int x,
                        int y)

isIn

public boolean isIn(int x,
                    int y)
Description copied from interface: Area
Check if the point is in the area.

Specified by:
isIn in interface Area

intersects

public boolean intersects(Area other)
Description copied from interface: Area
See if this Area intersects another. This intersection is not necessarily an intersection of the bounding rectangles.

Specified by:
intersects in interface Area

getRect

public Rect getRect(Rect dest)
Description copied from interface: Area
Get the bounding rectangle of the area.

Specified by:
getRect in interface Area
Parameters:
dest - an optional destination Rect.
Returns:
The dest Rect or a newly created Rect if dest is null.

equals

public boolean equals(Object other)
Description copied from class: Object
Returns if this object is considered equal to the other object.

Overrides:
equals in class Object
Parameters:
other - Another object to compare to.
Returns:
true if this object is considered equal to the other object.

setCorners

public Rect setCorners(int x1,
                       int y1,
                       int x2,
                       int y2)