|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Insets
com.tensegrity.graphics.Boundary
The Boundary class extends the functionalities of class
Insets by providing additional functionalities.
However by extending the Insets the Boundary
class is restricted to the 2d space.
| Field Summary | |
static Boundary |
DEFAULT_MAX_MIN_BOUNDARY
constant that defines a Boundary that is initialized to
have the upper / left corner in x and y direction at
Integer.MAX_VALUE and the lower / right cornder in x
and y direction at Integer.MIN_VALUE what makes it
an empty Boundary.
|
static Boundary |
DEFAULT_MIN_MAX_BOUNDARY
constant that defines a Boundary that is initialized to
have the upper / left corner in x and y direction at
Integer.MIN_VALUE and the lower / right cornder in x
and y direction at Integer.MAX_VALUE what makes it
to the greates Boundary that can be created.
|
static int |
INDEX_BOTTOM
constant that tells about an index in the array of normalized values |
static int |
INDEX_LEFT
constant that tells about an index in the array of normalized values |
static int |
INDEX_RIGHT
constant that tells about an index in the array of normalized values |
static int |
INDEX_TOP
constant that tells about an index in the array of normalized values |
| Fields inherited from class java.awt.Insets |
bottom, left, right, top |
| Constructor Summary | |
Boundary()
Default constructor that initializes an instance of the Boundary such that it lies at the origin coordinate and is
empty. |
|
Boundary(java.awt.Insets insets)
Constructor with a Insets instance given by
insets that initializes an instance of the
Boundary class such that it has the same origin coordinate
and the same end coordinate as the Insets instance. |
|
Boundary(int left,
int top,
int right,
int bottom)
Constructor with a coordinate for the origin given by left,
top and a coordinate for the end given by
right, bottom of the Boundary
instance. |
|
| Method Summary | |
boolean |
contains(Boundary boundary)
Returns a boolean that indicates whether the
Boundary given by boundary lies completely
within the Boundary or not. |
boolean |
contains(int x,
int y)
Returns a boolean that indicates whether the coordinate
given by x and y lies within the
Boundary or not. |
boolean |
contains(java.awt.Point pt)
Returns a boolean that indicates whether the
Point given by pt lies within the
Boundary or not. |
void |
deflate(int cxy)
Deflates the Boundary by the value given by
cxy in x direction and in y direction. |
void |
deflate(int cx,
int cy)
Deflates the Boundary by the value given by
cx in x direction and by the value given by cy
in y direction. |
void |
deflate(int cx1,
int cy1,
int cx2,
int cy2)
Deflates the Boundarys left side by the value given by
cx1, the top side by the value given by cy1,
the right side by the value given by cx2 and the bottom side
by the value given by cy2. |
boolean |
equalHeight(Boundary boundary)
Returns a boolean that indicates whether the height of the
Boundary given by boundary is equal to the
height of this Boundary. |
boolean |
equalSize(Boundary boundary)
Returns a boolean that indicates whether the width and the
height of the Boundary given by boundary are
equal to the width and the height of this Boundary. |
boolean |
equalWidth(Boundary boundary)
Returns a boolean that indicates whether the width of the
Boundary given by boundary is equal to the
width of this Boundary. |
Coordinate |
getCenter()
Returns the center coordinate of the Boundary instance as
a Coordinate. |
double |
getCenterDX()
Returns the current center in x direction of the Boundary
instance as a double. |
double |
getCenterDY()
Returns the current center in y direction of the Boundary
instance as a double. |
int |
getCenterX()
Returns the current center in x direction of the Boundary
instance as an int. |
int |
getCenterY()
Returns the current center in y direction of the Boundary
instance as an int. |
int |
getHeight()
Returns the current height of the Boundary instance. |
int[] |
getNormalizedValues()
Returns an int array with the normalized values for the
left, top, right and the bottom side of the Boundary.
|
int |
getWidth()
Returns the current width of the Boundary instance. |
void |
inflate(int cxy)
Inflates the Boundary by the value given by
cxy in x direction and in y direction. |
void |
inflate(int cx,
int cy)
Inflates the Boundary by the value given by
cx in x direction and by the value given by cy
in y direction. |
void |
inflate(int cx1,
int cy1,
int cx2,
int cy2)
Inflates the Boundarys left side by the value given by
cx1, the top side by the value given by cy1,
the right side by the value given by cx2 and the bottom side
by the value given by cy2. |
boolean |
intersect(java.awt.Insets insets)
Returns a boolean that indicates whether the
Boundary intersects the Insets given by
insets or not. |
void |
intersection(java.awt.Insets insets)
Creates the intersection of the Insets instance given by
insets and the Boundary instance. |
boolean |
isEmpty()
Returns a boolean that indicates whether the
Boundary is empty or not. |
void |
normalize()
Normalizes the Boundary. |
void |
offset(int cx,
int cy)
Adds the value given by cx to the left side and the right
side and the value given by cy to the top and the bottom
side of the Boundary. |
void |
set(java.awt.Insets insets)
Sets the origin coordinate and the ending coordinate of the Boundary instance to the values of the Insets
instance given by insets. |
void |
set(int left,
int top,
int right,
int bottom)
Sets the coordinate for the origin of the Boundary instance
to the values given by left, top and the
coordinate for the ending coordinate to the valus given by
right, bottom. |
void |
setHeight(int height)
Sets the height of the Boundary instance to the value given
by height. |
void |
setWidth(int width)
Sets the width of the Boundary instance to the value given
by width. |
java.lang.String |
toString()
Returns a String that represent the Boundary
and all of the attributes of it. |
void |
union(Boundary boundary)
Creates the union of the Boundary instance given by
boundary and the Boundary instance. |
void |
union(java.awt.Insets insets)
Creates the union of the Insets instance given by
insets and the Boundary instance. |
| Methods inherited from class java.awt.Insets |
clone, equals, hashCode |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Boundary DEFAULT_MAX_MIN_BOUNDARY
Boundary that is initialized to
have the upper / left corner in x and y direction at
Integer.MAX_VALUE and the lower / right cornder in x
and y direction at Integer.MIN_VALUE what makes it
an empty Boundary.
Boundary over a set of Boundarys.
Boundary.
public static final Boundary DEFAULT_MIN_MAX_BOUNDARY
Boundary that is initialized to
have the upper / left corner in x and y direction at
Integer.MIN_VALUE and the lower / right cornder in x
and y direction at Integer.MAX_VALUE what makes it
to the greates Boundary that can be created.
Boundary over a set of Boundarys.
Boundary.
public static final int INDEX_LEFT
public static final int INDEX_TOP
public static final int INDEX_RIGHT
public static final int INDEX_BOTTOM
| Constructor Detail |
public Boundary()
Boundary such that it lies at the origin coordinate and is
empty. Empty means in this case that the boundary has no width and no
height.
public Boundary(int left,
int top,
int right,
int bottom)
left,
top and a coordinate for the end given by
right, bottom of the Boundary
instance.
left - the new starting x componenttop - the new starting y componentright - the new ending x componentbottom - the new ending y componentpublic Boundary(java.awt.Insets insets)
Insets instance given by
insets that initializes an instance of the
Boundary class such that it has the same origin coordinate
and the same end coordinate as the Insets instance.
insets - the Insets instance to take the values from,
may not be null.| Method Detail |
public int getWidth()
Boundary instance.
Boundarypublic void setWidth(int width)
Boundary instance to the value given
by width.
width - the value to set the width of the Boundary
instance topublic int getHeight()
Boundary instance.
Boundarypublic void setHeight(int height)
Boundary instance to the value given
by height.
height - the value to set the height of the Boundary
instance topublic int getCenterX()
Boundary
instance as an int.
Boundary in x directionpublic int getCenterY()
Boundary
instance as an int.
Boundary in y directionpublic double getCenterDX()
Boundary
instance as a double.
Boundary in x directionpublic double getCenterDY()
Boundary
instance as a double.
Boundary in x directionpublic Coordinate getCenter()
Boundary instance as
a Coordinate.
Boundary
public void set(int left,
int top,
int right,
int bottom)
Boundary instance
to the values given by left, top and the
coordinate for the ending coordinate to the valus given by
right, bottom.
left - the new starting x componenttop - the new starting y componentright - the new ending x componentbottom - the new ending y componentpublic void set(java.awt.Insets insets)
Boundary instance to the values of the Insets
instance given by insets.
insets - the Insets instance to take the values frompublic void union(java.awt.Insets insets)
Insets instance given by
insets and the Boundary instance. The union
means that the origin coordinate and the ending coordinate are adjusted
to the smalles rectangle that encapsulates the rectangle of the
Boundary instance and the given Insets
instance.
insets - the Insets instance to create the union withpublic void union(Boundary boundary)
Boundary instance given by
boundary and the Boundary instance. The union
means that the origin coordinate and the ending coordinate are adjusted
to the smalles rectangle that encapsulates the rectangle of the
Boundary instance and the given Boundary
instance.
boundary - the Boundary instance to create the union withpublic void intersection(java.awt.Insets insets)
Insets instance given by
insets and the Boundary instance. The
intersection is the smalles rectangle that is encapsulated by the
Boundary instance and the given Insets
instance. Notice that the intersection rectangle can be empty.
insets - the Insets instance to create the intersection
withpublic boolean isEmpty()
boolean that indicates whether the
Boundary is empty or not. Empty means in this case that the
Boundary has a width of zero or a height of zero.
Boundary
is empty or notpublic boolean intersect(java.awt.Insets insets)
boolean that indicates whether the
Boundary intersects the Insets given by
insets or not.
insets - the Insets to check for intersection
Insets
intersects the Boundarypublic void inflate(int cxy)
Boundary by the value given by
cxy in x direction and in y direction.
cxy - the value to inflate all the sides of the
Boundary by
public void inflate(int cx,
int cy)
Boundary by the value given by
cx in x direction and by the value given by cy
in y direction.
cx - the value to inflate the Boundary by in x
directioncy - the value to inflate the Boundary by in y
direction
public void inflate(int cx1,
int cy1,
int cx2,
int cy2)
Boundarys left side by the value given by
cx1, the top side by the value given by cy1,
the right side by the value given by cx2 and the bottom side
by the value given by cy2.
cx1 - the value to inflate the Boundary by at the left
sidecy1 - the value to inflate the Boundary by at the top
sidecx2 - the value to inflate the Boundary by at the right
sidecy2 - the value to inflate the Boundary by at the
bottom sidepublic void deflate(int cxy)
Boundary by the value given by
cxy in x direction and in y direction.
cxy - the value to deflate all the sides of the
Boundary by
public void deflate(int cx,
int cy)
Boundary by the value given by
cx in x direction and by the value given by cy
in y direction.
cx - the value to deflate the Boundary by in x
directioncy - the value to deflate the Boundary by in y
direction
public void deflate(int cx1,
int cy1,
int cx2,
int cy2)
Boundarys left side by the value given by
cx1, the top side by the value given by cy1,
the right side by the value given by cx2 and the bottom side
by the value given by cy2.
cx1 - the value to deflate the Boundary by at the left
sidecy1 - the value to deflate the Boundary by at the top
sidecx2 - the value to deflate the Boundary by at the right
sidecy2 - the value to deflate the Boundary by at the
bottom side
public void offset(int cx,
int cy)
cx to the left side and the right
side and the value given by cy to the top and the bottom
side of the Boundary.
cx - the value to add to the left and the right side of the
Boundarycy - the valie to add to the top and the bottom side of the
Boundarypublic int[] getNormalizedValues()
int array with the normalized values for the
left, top, right and the bottom side of the Boundary.
Normalized means in this case that the values for the left(top) and the
right(bottom) side of the Boundary are swapped if the value
for the left is greater than the value for right side.
public void normalize()
Boundary. Normalizing means in this case that
the values for the left(top) and the right(bottom) side of the
Boundary are swapped if the value for the left is greater
than the value for right side.
public boolean contains(int x,
int y)
boolean that indicates whether the coordinate
given by x and y lies within the
Boundary or not.
x - the x component of the coordinate to check fory - the y component of the coordinate to check for
Boundary or notpublic boolean contains(java.awt.Point pt)
boolean that indicates whether the
Point given by pt lies within the
Boundary or not.
pt - the point to check for
Boundary or notpublic boolean contains(Boundary boundary)
boolean that indicates whether the
Boundary given by boundary lies completely
within the Boundary or not.
boundary - the Boundary to check for
Boundary is contained by this Boundary or notpublic boolean equalWidth(Boundary boundary)
boolean that indicates whether the width of the
Boundary given by boundary is equal to the
width of this Boundary.
boundary - the Boundary to check for
Boundary has the same width as this Boundary
or notpublic boolean equalHeight(Boundary boundary)
boolean that indicates whether the height of the
Boundary given by boundary is equal to the
height of this Boundary.
boundary - the Boundary to check for
Boundary has the same height as this Boundary
or notpublic boolean equalSize(Boundary boundary)
boolean that indicates whether the width and the
height of the Boundary given by boundary are
equal to the width and the height of this Boundary.
boundary - the Boundary to check for
Boundary has the same width and height as this
Boundary or notpublic java.lang.String toString()
String that represent the Boundary
and all of the attributes of it. For instance this representation can be
used for tracing purposes and such.
Boundary
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||