edu.gwu.geometry
Class IntRectangle

java.lang.Object
  |
  +--edu.gwu.geometry.IntRectangle

public class IntRectangle
extends java.lang.Object

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

ID

public int ID
An ID field for identification or hashing, unique to each instance.

topLeft

public IntPoint topLeft
The top left corner.

bottomRight

public IntPoint bottomRight
The bottom right corner.
Constructor Detail

IntRectangle

public IntRectangle(int topLeftX,
                    int topLeftY,
                    int bottomRightX,
                    int bottomRightY)
Constructor that takes (x,y) values for the two corners.
Parameters:
topLeftX - an int value
topLeftY - an int value
bottomRightX - an int value
bottomRightY - an int value

IntRectangle

public IntRectangle(IntPoint topLeft,
                    IntPoint bottomRight)
Constructor that takes IntPoint instances for the two corners.
Parameters:
topLeft - an IntPoint value
bottomRight - an IntPoint value
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides Object's equals method.
Overrides:
equals in class java.lang.Object
Parameters:
obj - an Object value
Returns:
a boolean value

toString

public java.lang.String toString()
Overrides Object's toString() method.
Overrides:
toString in class java.lang.Object
Returns:
a String value

getID

public int getID()
Method getID return's this rectangle's unique ID.
Returns:
an int value

resetIDs

public static void resetIDs()