Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.sim.space
Class ObjectLocation

    java.lang.Object
      uchicago.src.sim.space.ObjectLocation

    public class ObjectLocation

extends java.lang.Object

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 ``

       ObjectLocation ol = new ObjectLocation(someObj, 3, 3);
       Agent a = (Agent)ol.obj;
       int xLocl = ol.x;
       ...

However, changing these x and y coordinates does not effect the actual object coordinates in any way.

ObjectLocation overrides equals and will return true when the object and the x and y coordinates are equal.

Version:
  $Revision: 1.4 $ $Date: 2004/11/03 19:50:57 $

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

### obj

    public java.lang.Object obj

  The object at this ObjectLocation.

### x

    public int x

  The x coordinate of the object.

### y

    public int y

  The y coordinate of the object.

### z

    public int z

  The z (unused and always 0) coordinate of the object.

Constructor Detail

### ObjectLocation

    public ObjectLocation(java.lang.Object obj,
                          int x,
                          int y)

  Creates an ObjectLocation from the specified object and coordinates.

  Parameters:
    `obj` - the object at this location.
    `x` - the x coordinate
    `y` - the y coordinaate

Method Detail

### makeObjectLocations

    public 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. This will return an empty ArrayList if the List argument in empty.

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### areXYEqual

    public 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. Otherwise, return false;

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD