sim.field.grid
Class ObjectGrid3D

java.lang.Object
  extended bysim.field.grid.AbstractGrid3D
      extended bysim.field.grid.ObjectGrid3D
All Implemented Interfaces:
Grid3D, java.io.Serializable

public class ObjectGrid3D
extends AbstractGrid3D

A wrapper for 3D arrays of Objects.

This object expects that the 3D arrays are rectangular. You are encouraged to access the array directly. The object implements all of the Grid3D interface. See Grid3D for rules on how to properly implement toroidal grids.

The width and height and length (z dimension) of the object are provided to avoid having to say field[x].length, etc.

If you need arbitrary numbers of Objects to be able to occupy the same location in the grid, or if you have very few Objects and a very large grid, you should probably use SparseGrid2D instead.

See Also:
Serialized Form

Field Summary
 java.lang.Object[][][] field
           
 
Fields inherited from class sim.field.grid.AbstractGrid3D
height, length, width
 
Constructor Summary
ObjectGrid3D(int xdim, int ydim, int zdim)
           
ObjectGrid3D(int xdim, int ydim, int zdim, java.lang.Object initialValue)
           
ObjectGrid3D(ObjectGrid3D values)
           
 
Method Summary
 java.lang.Object get(int x, int y, int z)
           
 void getNeighborsHamiltonianDistance(int x, int y, int z, int dist, boolean toroidal, Bag result, IntBag xPos, IntBag yPos, IntBag zPos)
           
 void getNeighborsMaxDistance(int x, int y, int z, int dist, boolean toroidal, Bag result, IntBag xPos, IntBag yPos, IntBag zPos)
           
 void set(int x, int y, int z, java.lang.Object val)
           
 ObjectGrid3D setTo(java.lang.Object thisObj)
           
 ObjectGrid3D setTo(ObjectGrid3D values)
           
 
Methods inherited from class sim.field.grid.AbstractGrid3D
getHeight, getLength, getNeighborsHamiltonianDistance, getNeighborsMaxDistance, getWidth, stx, sty, stz, tx, ty, tz
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

public java.lang.Object[][][] field
Constructor Detail

ObjectGrid3D

public ObjectGrid3D(int xdim,
                    int ydim,
                    int zdim)

ObjectGrid3D

public ObjectGrid3D(int xdim,
                    int ydim,
                    int zdim,
                    java.lang.Object initialValue)

ObjectGrid3D

public ObjectGrid3D(ObjectGrid3D values)
Method Detail

set

public final void set(int x,
                      int y,
                      int z,
                      java.lang.Object val)

get

public final java.lang.Object get(int x,
                                  int y,
                                  int z)

setTo

public final ObjectGrid3D setTo(java.lang.Object thisObj)

setTo

public final ObjectGrid3D setTo(ObjectGrid3D values)

getNeighborsMaxDistance

public final void getNeighborsMaxDistance(int x,
                                          int y,
                                          int z,
                                          int dist,
                                          boolean toroidal,
                                          Bag result,
                                          IntBag xPos,
                                          IntBag yPos,
                                          IntBag zPos)

getNeighborsHamiltonianDistance

public final void getNeighborsHamiltonianDistance(int x,
                                                  int y,
                                                  int z,
                                                  int dist,
                                                  boolean toroidal,
                                                  Bag result,
                                                  IntBag xPos,
                                                  IntBag yPos,
                                                  IntBag zPos)