java.lang.Object | +--edu.gwu.geometry.IntRectangle
Class IntRectangle
represents a rectangle with
integer coordinates by storing the top-left and bottom-right
corners as IntPoint
instances. An IntPoint
stores the x and y coordinates of a point with integer coordinates.
Field Summary | |
IntPoint |
bottomRight
The bottom right corner. |
int |
ID
An ID field for identification or hashing, unique to each instance. |
IntPoint |
topLeft
The top left corner. |
Constructor Summary | |
IntRectangle(int topLeftX,
int topLeftY,
int bottomRightX,
int bottomRightY)
Constructor that takes (x,y) values for the two corners. |
|
IntRectangle(IntPoint topLeft,
IntPoint bottomRight)
Constructor that takes IntPoint instances for the two corners. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Overrides Object's equals method. |
int |
getID()
Method getID return's this rectangle's unique ID. |
static void |
resetIDs()
|
java.lang.String |
toString()
Overrides Object's toString() method. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int ID
public IntPoint topLeft
public IntPoint bottomRight
Constructor Detail |
public IntRectangle(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY)
topLeftX
- an int
valuetopLeftY
- an int
valuebottomRightX
- an int
valuebottomRightY
- an int
valuepublic IntRectangle(IntPoint topLeft, IntPoint bottomRight)
IntPoint
instances for the two corners.topLeft
- an IntPoint
valuebottomRight
- an IntPoint
valueMethod Detail |
public boolean equals(java.lang.Object obj)
equals
method.equals
in class java.lang.Object
obj
- an Object
valueboolean
valuepublic java.lang.String toString()
toString()
method.toString
in class java.lang.Object
String
valuepublic int getID()
getID
return's this rectangle's unique ID.int
valuepublic static void resetIDs()