org.garret.perst
Class RectangleR2

java.lang.Object
  extended byorg.garret.perst.RectangleR2
All Implemented Interfaces:
java.lang.Cloneable, IValue

public class RectangleR2
extends java.lang.Object
implements IValue, java.lang.Cloneable

R2 rectangle class. This class is used in spatial index.


Constructor Summary
RectangleR2()
          Default constructor for PERST
RectangleR2(double top, double left, double bottom, double right)
          Construct rectangle with specified coordinates
RectangleR2(RectangleR2 r)
          Create copy of the rectangle
 
Method Summary
 double area()
          Rectangle area
 java.lang.Object clone()
          Clone rectangle
 boolean contains(RectangleR2 r)
          Checks if this rectangle contains the specified rectangle
 boolean equals(java.lang.Object o)
          Check if two rectangles are equal
 double getBottom()
          Greatest Y coordinate of the rectangle
 double getLeft()
          Smallest X coordinate of the rectangle
 double getRight()
          Greatest X coordinate of the rectangle
 double getTop()
          Smallest Y coordinate of the rectangle
 int hashCode()
          Hash code consists of all rectangle coordinates
 boolean intersects(RectangleR2 r)
          Checks if this rectangle intersects with specified rectangle
 void join(RectangleR2 r)
          Join two rectangles.
static RectangleR2 join(RectangleR2 a, RectangleR2 b)
          Non destructive join of two rectangles.
static double joinArea(RectangleR2 a, RectangleR2 b)
          Area of covered rectangle for two sepcified rectangles
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RectangleR2

public RectangleR2()
Default constructor for PERST


RectangleR2

public RectangleR2(double top,
                   double left,
                   double bottom,
                   double right)
Construct rectangle with specified coordinates


RectangleR2

public RectangleR2(RectangleR2 r)
Create copy of the rectangle

Method Detail

area

public final double area()
Rectangle area


clone

public java.lang.Object clone()
Clone rectangle


contains

public final boolean contains(RectangleR2 r)
Checks if this rectangle contains the specified rectangle


equals

public boolean equals(java.lang.Object o)
Check if two rectangles are equal


getBottom

public final double getBottom()
Greatest Y coordinate of the rectangle


getLeft

public final double getLeft()
Smallest X coordinate of the rectangle


getRight

public final double getRight()
Greatest X coordinate of the rectangle


getTop

public final double getTop()
Smallest Y coordinate of the rectangle


hashCode

public int hashCode()
Hash code consists of all rectangle coordinates


intersects

public final boolean intersects(RectangleR2 r)
Checks if this rectangle intersects with specified rectangle


join

public final void join(RectangleR2 r)
Join two rectangles. This rectangle is updates to contain cover of this and specified rectangle.

Parameters:
r - rectangle to be joined with this rectangle

join

public static RectangleR2 join(RectangleR2 a,
                               RectangleR2 b)
Non destructive join of two rectangles.

Parameters:
a - first joined rectangle
b - second joined rectangle
Returns:
rectangle containing cover of these two rectangles

joinArea

public static double joinArea(RectangleR2 a,
                              RectangleR2 b)
Area of covered rectangle for two sepcified rectangles


toString

public java.lang.String toString()