public class GridPoint
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
GridPoint(int col,
int row)
Creates a point at the given column and row indices.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getCol() |
int |
getRow() |
int |
hashCode() |
GridPoint |
subtract(GridPoint other)
Subtracts another grid point from this one.
|
java.lang.String |
toString() |
public GridPoint(int col, int row)
java.lang.IllegalArgumentException
- if either col
or row
is negativepublic GridPoint subtract(GridPoint other)
row
or col
would be negative,
it is set to zero.other
- the point to subtract from this onepublic int getCol()
public int getRow()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object