|
AP® Computer Science Marine Biology Simulation | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Location
AP® Computer Science Marine Biology Simulation:
A Location
object represents the row and column of a
location in a two-dimensional grid.
The Location
class is
copyright© 2002 College Entrance Examination Board
(www.collegeboard.com).
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)
Indicates whether some other Location object is
"equal to" this one. |
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 |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Location(int row, int col)
Location
object.row
- location's rowcol
- location's columnMethod Detail |
public int row()
public int col()
public boolean equals(java.lang.Object other)
Location
object is
"equal to" this one.equals
in class java.lang.Object
other
- 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.Object
Location
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.Comparable
other
- the other location to testother
, zero if the two locations are equal,
or a positive integer if this location is greater than
other
public java.lang.String toString()
toString
in class java.lang.Object
|
AP® Computer Science Marine Biology Simulation | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |