uchicago.src.sim.space
Class OrderedCell

java.lang.Object
  extended by uchicago.src.sim.space.OrderedCell
All Implemented Interfaces:
Cell

public class OrderedCell
extends java.lang.Object
implements Cell

A grid cell whose occupants are stored in order of insertion. The first object inserted will be on the bottom of the stack at position 0, and the last will be on the top at position num_objects - 1.

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

Constructor Summary
OrderedCell()
           
 
Method Summary
 void add(java.lang.Object o)
          Adds an object to this cell.
 void clear()
          Clears all the objects from this cell.
 java.lang.Object getFirst()
          Gets the first (bottom) object in the cell.
 int getIndexOf(java.lang.Object o)
          Gets the index of the specified object.
 java.lang.Object getLast()
          Gets the last (top) object in the cell.
 java.util.List getList()
          Returns a List of the objects contained in this cell.
 java.lang.Object getObject(int index)
          Gets the object at the specified index.
 void insert(int index, java.lang.Object o)
          Inserts the specified object at the specified index.
 java.util.Iterator iterator()
          Returns an Iterator of the objects contained in this cell.
 java.lang.Object remove(int index)
          Removes the object at the specified index.
 void remove(java.lang.Object o)
          Removes the specified object from this cell.
 int size()
          Gets the number of objects in this cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedCell

public OrderedCell()
Method Detail

getFirst

public java.lang.Object getFirst()
Gets the first (bottom) object in the cell. The first object will be the first object added relative to the other objects in the cell.


getLast

public java.lang.Object getLast()
Gets the last (top) object in the cell. The last object will be the last object added relative to the other objects in the cell.


getObject

public java.lang.Object getObject(int index)
Gets the object at the specified index.


size

public int size()
Gets the number of objects in this cell.

Specified by:
size in interface Cell

getIndexOf

public int getIndexOf(java.lang.Object o)
Gets the index of the specified object.


insert

public void insert(int index,
                   java.lang.Object o)
Inserts the specified object at the specified index.


remove

public java.lang.Object remove(int index)
Removes the object at the specified index.

Parameters:
index - the index of the object to remove

clear

public void clear()
Clears all the objects from this cell.

Specified by:
clear in interface Cell

add

public void add(java.lang.Object o)
Adds an object to this cell.

Specified by:
add in interface Cell

getList

public java.util.List getList()
Returns a List of the objects contained in this cell.

Specified by:
getList in interface Cell

iterator

public java.util.Iterator iterator()
Returns an Iterator of the objects contained in this cell.

Specified by:
iterator in interface Cell

remove

public void remove(java.lang.Object o)
Removes the specified object from this cell.

Specified by:
remove in interface Cell