|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.geometry.Rectangles
public class Rectangles
Rectangles is a class which maintains a list of java.awt.Rectangle objects. The Rectangles class also provides various rectangle related services.
Constructor Summary | |
---|---|
Rectangles()
|
Method Summary | |
---|---|
void |
add(java.awt.Rectangle rect)
Adds a rectangle. |
java.lang.Object |
clone()
Returns a clone of the current Rectangles object |
int |
count()
Returns the number of rectangles in the list. |
int |
count(com.sas.util.PredicateInterface pi)
Returns the number of rectangles in the list that satisfy the given predicate. |
void |
dump()
Prints each rectangle in the list to standard out. |
java.awt.Rectangle |
get(int index)
Returns the rectangle at the specified index. |
static int |
getBottom(java.awt.Rectangle rect)
Returns the bottom edge of the specified rectangle. |
static int |
getRight(java.awt.Rectangle rect)
Returns the right edge of the specified rectangle. |
static boolean |
intersect(java.awt.Rectangle r1,
java.awt.Rectangle r2,
java.awt.Rectangle rout,
java.awt.Rectangle[] r1Left,
int[] nr1Left,
java.awt.Rectangle[] r2Left,
int[] nr2Left)
Computes the intersection of two rectangles. |
void |
intersect(java.awt.Rectangle r1,
Rectangles list)
Computes the intersection of the specified rectangle and list. |
static boolean |
intersectRects(java.awt.Rectangle r1,
java.awt.Rectangle r2,
java.awt.Rectangle rx)
Computes the intersection of the specified rectangles. |
void |
negate(java.awt.Rectangle universe)
Negates the set of rectangles. |
void |
removeAll()
Empties the rectangle list. |
static void |
setBottom(java.awt.Rectangle rect,
int bottom)
Sets the bottom edge of the specified rectangle. |
static void |
setRectBounds(java.awt.Rectangle rect,
int x1,
int y1,
int x2,
int y2)
Sets the bounds of the given rectangle. |
static void |
setRight(java.awt.Rectangle rect,
int right)
Sets the right edge of the specified rectangle. |
void |
unite(Rectangles list)
Combines two rectangle lists. |
Constructor Detail |
---|
public Rectangles()
Method Detail |
---|
public void add(java.awt.Rectangle rect)
rect
- the rectangle to addpublic static boolean intersect(java.awt.Rectangle r1, java.awt.Rectangle r2, java.awt.Rectangle rout, java.awt.Rectangle[] r1Left, int[] nr1Left, java.awt.Rectangle[] r2Left, int[] nr2Left)
r1
- the first input rectangler2
- the second input rectanglerout
- the resulting intersection; may be null if you don't carer1Left
- four-element array of "leftover" r1 rectangles (optional)nr1Left
- number of r1 things (max 4) (optional)r2Left
- four-element array of "leftover" r2 rectangles (optional)nr2Left
- number of r2 things (max 4) (optional)
public void intersect(java.awt.Rectangle r1, Rectangles list)
r1
- the Rectangle to intersectlist
- the Rectangles oject to intersectpublic void negate(java.awt.Rectangle universe)
universe
- the bounds to negate againstpublic void unite(Rectangles list)
list
- the list to combine with this onepublic void dump()
public static int getBottom(java.awt.Rectangle rect)
public static int getRight(java.awt.Rectangle rect)
public static void setBottom(java.awt.Rectangle rect, int bottom)
rect
- the rectangle to set the bottom edge ofbottom
- the new value for the bottom edgepublic static void setRight(java.awt.Rectangle rect, int right)
rect
- the rectangle to set the right edge ofright
- the new value for the right edgepublic static boolean intersectRects(java.awt.Rectangle r1, java.awt.Rectangle r2, java.awt.Rectangle rx)
r1
- first rectangle to intersectr2
- second rectangle to intersectrx
- resulting rectangle
public static void setRectBounds(java.awt.Rectangle rect, int x1, int y1, int x2, int y2)
rect
- the rectangle to set the bounds ofx1
- the new left edgey1
- the new top edgex2
- the new right edgey2
- the new bottom edgepublic java.awt.Rectangle get(int index)
index
- the index of the rectangle to retrievepublic void removeAll()
public int count()
count
in interface com.sas.util.Countable
public int count(com.sas.util.PredicateInterface pi)
pi
- the predicate to satisfypublic java.lang.Object clone()
clone
in interface com.sas.PublicClonable
clone
in class java.lang.Object
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |