Class Bounds

java.lang.Object
  extended by Bounds

public class Bounds
extends java.lang.Object

Represents a immutable two-dimensional rectangle, normally used for representing the bounds of a planar object.


Field Summary
static Bounds EMPTY_BOUNDS
          An object representing an empty bounding rectangle.
 
Method Summary
 Bounds add(Bounds o)
          Returns a bounding rectangle containing both this rectangle and the given rectangle.
 boolean contains(Bounds o)
          Returns true if the given rectangle lies entirely within this rectangle, even if it shares a boundary with this rectangle.
static Bounds create(double x, double y, double width, double height)
          Returns a rectangle starting at the given x- and y-coordinates and extending for the given width and height.
 double getHeight()
          Returns the height of this rectangle.
 double getWidth()
          Returns the width of this rectangle.
 double getX()
          Returns the least x-coordinate contained within this rectangle.
 double getY()
          Returns the least y-coordinate contained within this rectangle.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_BOUNDS

public static final Bounds EMPTY_BOUNDS
An object representing an empty bounding rectangle.

Method Detail

contains

public boolean contains(Bounds o)
Returns true if the given rectangle lies entirely within this rectangle, even if it shares a boundary with this rectangle.


add

public Bounds add(Bounds o)
Returns a bounding rectangle containing both this rectangle and the given rectangle.


getX

public double getX()
Returns the least x-coordinate contained within this rectangle.


getY

public double getY()
Returns the least y-coordinate contained within this rectangle.


getWidth

public double getWidth()
Returns the width of this rectangle.


getHeight

public double getHeight()
Returns the height of this rectangle.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

create

public static Bounds create(double x,
                            double y,
                            double width,
                            double height)
Returns a rectangle starting at the given x- and y-coordinates and extending for the given width and height.