uchicago.src.sim.topology.space.d3
Class AbstractObject3DSpace

java.lang.Object
  extended byuchicago.src.sim.topology.space.d3.AbstractObject3DTopology
      extended byuchicago.src.sim.topology.space.d3.AbstractObject3DSpace
All Implemented Interfaces:
ModifyableTopology, Object3DSpace, RelationTopology, Space
Direct Known Subclasses:
Multi3DGrid, Object3DGrid

public abstract class AbstractObject3DSpace
extends AbstractObject3DTopology
implements Object3DSpace

Base class for grids whose cells can hold one or more occupants. The actual object held in the grid cell is a Object2DLocation object.

Version:
$Revision: 1.3 $ $Date: 2004/11/03 19:51:04 $

Nested Class Summary
 class AbstractObject3DSpace.Abstract3DLocation
          A data structure holding an object and the x and y coordinates of that object.
 
Field Summary
protected  Object3DLocation[][][] matrix
           
 
Fields inherited from class uchicago.src.sim.topology.space.d3.AbstractObject3DTopology
locations
 
Constructor Summary
AbstractObject3DSpace(java.lang.String type, int xSize, int ySize, int zSize)
           
 
Method Summary
abstract  Location getLocation(int x, int y, int z)
          Gets the Object2DLocation object at the specified coordinates.
 Location getLocation(java.lang.Object obj)
          Attempts to get the Location for a specific object.
 double[] getSize()
          Gets the dimension of the space
 int getSizeX()
           
 int getSizeY()
           
 int getSizeZ()
           
 void removeLocation(int x, int y, int z)
          Clears the contents the specified cell.
 void removeLocation(Location location)
          Clears the contents the specified location.
 void trim()
          Releases any superfluous memory.
 int xnorm(int x)
           
 int ynorm(int y)
           
 int znorm(int z)
           
 
Methods inherited from class uchicago.src.sim.topology.space.d3.AbstractObject3DTopology
addRelation, distance, getRelations, getRelations, getRelationType, removeRelation, setRelationType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrix

protected Object3DLocation[][][] matrix
Constructor Detail

AbstractObject3DSpace

public AbstractObject3DSpace(java.lang.String type,
                             int xSize,
                             int ySize,
                             int zSize)
Method Detail

removeLocation

public void removeLocation(Location location)
Clears the contents the specified location.

Specified by:
removeLocation in interface Space
Parameters:
location - the location to remove from the space

removeLocation

public void removeLocation(int x,
                           int y,
                           int z)
Clears the contents the specified cell.

Specified by:
removeLocation in interface Object3DSpace
Parameters:
x - the x coordinate of the cell to clear
y - the y coordinate of the cell to clear

getLocation

public abstract Location getLocation(int x,
                                     int y,
                                     int z)
Gets the Object2DLocation object at the specified coordinates.

Specified by:
getLocation in interface Object3DSpace
Parameters:
x - the x coordinate
y - the y coordinate
Throws:
java.lang.IndexOutOfBoundsException - if the given coordinates are out of range (x < 0 || x >= xSize || y < 0 || y >= ySize)

getLocation

public Location getLocation(java.lang.Object obj)
Description copied from interface: Space
Attempts to get the Location for a specific object.

Specified by:
getLocation in interface Space

getSize

public double[] getSize()
Description copied from interface: Space
Gets the dimension of the space

Specified by:
getSize in interface Space

getSizeX

public int getSizeX()
Specified by:
getSizeX in interface Object3DSpace

getSizeY

public int getSizeY()
Specified by:
getSizeY in interface Object3DSpace

getSizeZ

public int getSizeZ()
Specified by:
getSizeZ in interface Object3DSpace

trim

public void trim()
Releases any superfluous memory.

Specified by:
trim in interface Object3DSpace

xnorm

public int xnorm(int x)
Specified by:
xnorm in interface Object3DSpace

ynorm

public int ynorm(int y)
Specified by:
ynorm in interface Object3DSpace

znorm

public int znorm(int z)
Specified by:
znorm in interface Object3DSpace