civquest.util
Class Rectangle
java.lang.Object
civquest.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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Rectangle
public Rectangle(Coordinate topLeftCorner,
Coordinate bottomRightCorner)
Rectangle
public Rectangle(int x1,
int y1,
int x2,
int y2)
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