|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.space.ObjectLocation
public class ObjectLocation
A data structure holding an object and the x and y coordinates of that
object. Note that the instance variables obj, x and y are public and so
they may be accessed directly e.g
However, changing these x and y coordinates does not effect the actual
object coordinates in any way.
ObjectLocation ol = new ObjectLocation(someObj, 3, 3);
Agent a = (Agent)ol.obj;
int xLocl = ol.x;
...
ObjectLocation overrides equals and will return true when the object and the x and y coordinates are equal.
| Field Summary | |
|---|---|
java.lang.Object |
obj
The object at this ObjectLocation. |
int |
x
The x coordinate of the object. |
int |
y
The y coordinate of the object. |
int |
z
The z (unused and always 0) coordinate of the object. |
| Constructor Summary | |
|---|---|
ObjectLocation(java.lang.Object obj,
int x,
int y)
Creates an ObjectLocation from the specified object and coordinates. |
|
| Method Summary | |
|---|---|
boolean |
areXYEqual(ObjectLocation loc)
Returns true if the x and y coordinates of the specified ObjectLocation are equal to the x and y coordinates of this ObjectLocation. |
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
static java.util.ArrayList |
makeObjectLocations(java.util.List l,
int x,
int y)
Creates a List of ObjectLocation objects from the objects in List l at the coordinates x and y. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public java.lang.Object obj
public int x
public int y
public int z
| Constructor Detail |
|---|
public ObjectLocation(java.lang.Object obj,
int x,
int y)
obj - the object at this location.x - the x coordinatey - the y coordinaate| Method Detail |
|---|
public static java.util.ArrayList makeObjectLocations(java.util.List l,
int x,
int y)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean areXYEqual(ObjectLocation loc)
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||