goodslib
Class Rectangle

java.lang.Object
  extended bygoodslib.Rectangle
All Implemented Interfaces:
java.lang.Cloneable

public class Rectangle
extends java.lang.Object
implements java.lang.Cloneable

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


Constructor Summary
Rectangle()
          Default constructor for PERST
Rectangle(double top, double left, double bottom, double right)
          Construct rectangle with specified coordinates
Rectangle(Rectangle r)
          Create copy of the rectangle
 
Method Summary
 double area()
          Rectangle area
 java.lang.Object clone()
          Clone rectangle
 boolean contains(Rectangle 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(Rectangle r)
          Checks if this rectangle intersects with specified rectangle
 Rectangle join(Rectangle r)
          Join two rectangles.
static Rectangle join(Rectangle a, Rectangle b)
          Non destructive join of two rectangles.
static double joinArea(Rectangle a, Rectangle b)
          Area of covered rectangle for two sepcified rectangles
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rectangle

public Rectangle(Rectangle r)
Create copy of the rectangle


Rectangle

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


Rectangle

public Rectangle()
Default constructor for PERST

Method Detail

getTop

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


getLeft

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


getBottom

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


getRight

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


area

public final double area()
Rectangle area


joinArea

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


clone

public java.lang.Object clone()
Clone rectangle


join

public final Rectangle join(Rectangle 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
Returns:
this rectangle

join

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

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

intersects

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


contains

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


equals

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


hashCode

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


toString

public java.lang.String toString()