civquest.util
Class Rectangle

java.lang.Object
  extended bycivquest.util.Rectangle

public class Rectangle
extends java.lang.Object

A rectangle, defined by the top-left and the bottom-right-corner (inclusive) The top-left-corner must always have smaller/equal x and y-coords than the bottom-right-one. NO TESTS ON THAT ARE PERFORMED. The get-functions return references to the Coordinate-objects used for storing the corners, so DO NOT ALTER them.


Constructor Summary
Rectangle(Coordinate topLeftCorner, Coordinate bottomRightCorner)
           
Rectangle(int x1, int y1, int x2, int y2)
           
 
Method Summary
 Rectangle add(Coordinate coord)
           
 Rectangle add(int x, int y)
           
 boolean contains(Coordinate c)
          Returns if this Rectangle contains the given Coordinate c.
 Coordinate getBottomLeftCorner()
           
 Coordinate getBottomRightCorner()
           
 int getHeight()
           
 Coordinate getTopLeftCorner()
           
 Coordinate getTopRightCorner()
           
 int getWidth()
           
 int getX1()
           
 int getX2()
           
 int getY1()
           
 int getY2()
           
 void setBottomRightCorner(Coordinate bottomRightCorner)
           
 void setTopLeftCorner(Coordinate topLeftCorner)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rectangle

public Rectangle(Coordinate topLeftCorner,
                 Coordinate bottomRightCorner)

Rectangle

public Rectangle(int x1,
                 int y1,
                 int x2,
                 int y2)
Method Detail

setTopLeftCorner

public void setTopLeftCorner(Coordinate topLeftCorner)

getTopLeftCorner

public Coordinate getTopLeftCorner()

getBottomLeftCorner

public Coordinate getBottomLeftCorner()

setBottomRightCorner

public void setBottomRightCorner(Coordinate bottomRightCorner)

getBottomRightCorner

public Coordinate getBottomRightCorner()

getTopRightCorner

public Coordinate getTopRightCorner()

getX1

public int getX1()

getY1

public int getY1()

getX2

public int getX2()

getY2

public int getY2()

getWidth

public int getWidth()

getHeight

public int getHeight()

toString

public java.lang.String toString()

add

public Rectangle add(Coordinate coord)

add

public Rectangle add(int x,
                     int y)

contains

public boolean contains(Coordinate c)
Returns if this Rectangle contains the given Coordinate c.

Parameters:
c - any Coordinate
Returns:
if this Rectangle contains c