sim.field.grid
Class IntGrid3D

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

public class IntGrid3D
extends AbstractGrid3D

A wrapper for 3D arrays of ints.

This object expects that the 3D arrays are rectangular. You are encouraged to access the array directly, but fast-inlined methods are provided for you if you want something safer. 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.

See Also:
Serialized Form

Field Summary
 int[][][] field
           
 
Fields inherited from class sim.field.grid.AbstractGrid3D
height, length, width
 
Constructor Summary
IntGrid3D(IntGrid3D values)
           
IntGrid3D(int xdim, int ydim, int zdim)
           
IntGrid3D(int xdim, int ydim, int zdim, int initialValue)
           
 
Method Summary
 IntGrid3D add(int withThisMuch)
           
 IntGrid3D add(IntGrid3D withThis)
           
 int get(int x, int y, int z)
           
 void getNeighborsHamiltonianDistance(int x, int y, int z, int dist, boolean toroidal, IntBag result, IntBag xPos, IntBag yPos, IntBag zPos)
           
 void getNeighborsMaxDistance(int x, int y, int z, int dist, boolean toroidal, IntBag result, IntBag xPos, IntBag yPos, IntBag zPos)
           
 IntGrid3D lowerBound(int toNoLowerThanThisMuch)
           
 int max()
           
 double mean()
           
 int min()
           
 IntGrid3D multiply(int byThisMuch)
           
 IntGrid3D multiply(IntGrid3D withThis)
           
 int set(int x, int y, int z, int val)
           
 IntGrid3D setTo(int thisMuch)
           
 IntGrid3D setTo(IntGrid3D values)
           
 IntGrid3D upperBound(int toNoMoreThanThisMuch)
           
 
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 int[][][] field
Constructor Detail

IntGrid3D

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

IntGrid3D

public IntGrid3D(int xdim,
                 int ydim,
                 int zdim,
                 int initialValue)

IntGrid3D

public IntGrid3D(IntGrid3D values)
Method Detail

set

public final int set(int x,
                     int y,
                     int z,
                     int val)

get

public final int get(int x,
                     int y,
                     int z)

max

public final int max()

min

public final int min()

mean

public final double mean()

setTo

public final IntGrid3D setTo(int thisMuch)

setTo

public final IntGrid3D setTo(IntGrid3D values)

upperBound

public final IntGrid3D upperBound(int toNoMoreThanThisMuch)

lowerBound

public final IntGrid3D lowerBound(int toNoLowerThanThisMuch)

add

public final IntGrid3D add(int withThisMuch)

add

public final IntGrid3D add(IntGrid3D withThis)

multiply

public final IntGrid3D multiply(int byThisMuch)

multiply

public final IntGrid3D multiply(IntGrid3D withThis)

getNeighborsMaxDistance

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

getNeighborsHamiltonianDistance

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