Oxygen XML Editor 11.2 Author API

ro.sync.exml.view.graphics
Class Rectangle

java.lang.Object
  extended by ro.sync.exml.view.graphics.Rectangle
All Implemented Interfaces:
Shape

public class Rectangle
extends Object
implements Shape

Rectangle.


Field Summary
 int height
          The height.
 int width
          The width.
 int x
          The x.
 int y
          The y.
 
Constructor Summary
Rectangle(int x, int y, int width, int height)
          Constructor.
Rectangle(Rectangle r)
          Copy constructor.
 
Method Summary
 boolean adjacent(Rectangle r)
           
 boolean contains(int x, int y)
          Checks whether or not this Rectangle contains the point at the specified location (xy).
 boolean contains(Rectangle r)
          Checks whether or not this Rectangle entirely contains the specified Rectangle.
 boolean equals(Object obj)
          Checks whether two rectangles are equal.
 Rectangle getBounds()
           
 int getHeight()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
 Rectangle intersection(Rectangle r)
          Computes the intersection of this Rectangle with the specified Rectangle.
 boolean intersects(int rX, int rY, int rW, int rH)
          Determines whether or not this Rectangle and the specified Rectangle intersect.
 boolean intersects(Rectangle r)
          Determines whether or not this Rectangle and the specified Rectangle intersect.
static void main(String[] args)
          TC main.
 String toString()
          Returns a String representing this Rectangle and its values.
 Shape translate(int tx, int ty)
          Translate the shape into another one.
 Rectangle union(Rectangle r)
          Computes the union of this Rectangle with the specified Rectangle.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public int width
The width.


height

public int height
The height.


x

public int x
The x.


y

public int y
The y.

Constructor Detail

Rectangle

public Rectangle(int x,
                 int y,
                 int width,
                 int height)
Constructor.

Parameters:
x - The x coordinate.
y - The y coordinate.
width - The width.
height - The height.

Rectangle

public Rectangle(Rectangle r)
Copy constructor.

Parameters:
r - The other rectangle to be used.
Method Detail

intersects

public final boolean intersects(Rectangle r)
Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty.

Parameters:
r - the specified Rectangle
Returns:
true if the specified Rectangle and this Rectangle intersect; false otherwise.

intersects

public final boolean intersects(int rX,
                                int rY,
                                int rW,
                                int rH)
Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty.

Parameters:
rX - X of rect
rY - Y of rect
rW - Width of rect
rH - Height of rect
Returns:
true if the specified Rectangle and this Rectangle intersect; false otherwise.

contains

public boolean contains(Rectangle r)
Checks whether or not this Rectangle entirely contains the specified Rectangle.

Parameters:
r - the specified Rectangle
Returns:
true if the Rectangle is contained entirely inside this Rectangle;false otherwise.
Since:
JDK1.1

contains

public boolean contains(int x,
                        int y)
Checks whether or not this Rectangle contains the point at the specified location (xy).

Parameters:
x - the specified x coordinate
y - the specified y coordinate
Returns:
true if the point (xy) is inside this Rectangle; false otherwise.
Since:
JDK1.1

toString

public String toString()
Returns a String representing this Rectangle and its values.

Overrides:
toString in class Object
Returns:
a String representing this Rectangle object's coordinate and size values.

equals

public boolean equals(Object obj)
Checks whether two rectangles are equal.

The result is true if and only if the argument is not null and is a Rectangle object that has the same top-left corner, width, and height as this Rectangle.

Overrides:
equals in class Object
Parameters:
obj - the Object to compare with this Rectangle
Returns:
true if the objects are equal; false otherwise.

union

public Rectangle union(Rectangle r)
Computes the union of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the union of the two rectangles

Parameters:
r - the specified Rectangle
Returns:
the smallest Rectangle containing both the specified Rectangle and this Rectangle.

getHeight

public int getHeight()
Returns:
The rectangle height.

getWidth

public int getWidth()
Returns:
The rectangle width.

getX

public int getX()
Returns:
The rectangle x coordinate.

getY

public int getY()
Returns:
The rectangle y coordinate.

adjacent

public boolean adjacent(Rectangle r)
Parameters:
r - The rectangle to check for adjacency.
Returns:
True if the rectangles are neighbours around one margin and they do not intersect each other.

intersection

public Rectangle intersection(Rectangle r)
Computes the intersection of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the intersection of the two rectangles. If the two rectangles do not intersect, the result will be an empty rectangle.

Parameters:
r - the specified Rectangle
Returns:
the largest Rectangle contained in both the specified Rectangle and in this Rectangle; or if the rectangles do not intersect, an empty rectangle.

main

public static void main(String[] args)
TC main.

Parameters:
args - Main args

getBounds

public Rectangle getBounds()
Specified by:
getBounds in interface Shape
Returns:
The bounds of this shape.
See Also:
Shape.getBounds()

translate

public Shape translate(int tx,
                       int ty)
Description copied from interface: Shape
Translate the shape into another one.

Specified by:
translate in interface Shape
Parameters:
tx - the distance by which coordinates are translated in the X axis direction
ty - the distance by which coordinates are translated in the Y axis direction
Returns:
The newly translated shape
See Also:
Shape.translate(int, int)

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.