|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Location
Marine Biology Simulation:
A Location object represents the row and column of a
location in a two-dimensional grid.
| Constructor Summary | |
Location(int row,
int col)
Constructs a Location object. |
|
| Method Summary | |
int |
col()
Returns the column coordinate of this location. |
int |
compareTo(java.lang.Object other)
Compares this location to other for ordering. |
boolean |
equals(java.lang.Object other)
Tests two locations for equivalence. |
int |
hashCode()
Generates a hash code for this location (will not be tested on the Advanced Placement exam). |
int |
row()
Returns the row coordinate of this location. |
java.lang.String |
toString()
Represents this location as a string. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Location(int row,
int col)
Location object.row - location's rowcol - location's column| Method Detail |
public int row()
public int col()
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - the other location to testtrue if other is at the
same row and column as the current location;
false otherwisepublic int hashCode()
hashCode in class java.lang.ObjectLocation objectpublic int compareTo(java.lang.Object other)
other for ordering.
Returns a negative integer, zero, or a positive integer as this
location is less than, equal to, or greater than other.
Locations are ordered in row-major order.
(Precondition: other is a Location object.)compareTo in interface java.lang.Comparableother - the other location to testother, zero if the two locations are equal,
or a positive integer if this location is greater than
otherpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||