Package HAL.GridsAndAgents
Class Grid3Dint
- java.lang.Object
-
- HAL.GridsAndAgents.Grid3Dint
-
- All Implemented Interfaces:
Grid3D,java.io.Serializable
public class Grid3Dint extends java.lang.Object implements Grid3D, java.io.Serializable
a 3D Grid of ints- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Grid3Dint(int xDim, int yDim, int zDim)creates a new Grid3Dint of dimensions xDim by yDim by zDim with optional wraparoundGrid3Dint(int xDim, int yDim, int zDim, boolean wrapX, boolean wrapY, boolean wrapZ)creates a new Grid3Dint of dimensions xDim by yDim by zDim without wraparound
-
Method Summary
Modifier and Type Method Description voidAdd(int i, int val)adds to the current field value at the specified indexvoidAdd(int x, int y, int z, int val)adds to the current field value at the specified coordinatesvoidAddAll(int val)adds specified value to all entries of the curr fieldvoidBoundAll(int min, int max)Bounds all values in the current field between min and maxintGet(int i)gets the current field value at the specified coordinatesintGet(int x, int y, int z)gets the current field value at the specified coordinatesintGetAvg()gets the average value of all squares in the current fieldint[]GetField()returns the complete field as an arraybooleanIsWrapX()booleanIsWrapY()booleanIsWrapZ()intLength()voidScale(int i, double val)multiplies the current field value at the specified indexvoidScale(int x, int y, int z, double val)multiplies the current field value at the specified coordinatesvoidScaleAll(double val)multiplies all entries in the field by the valuevoidSet(int i, int val)sets the current field value at the specified indexvoidSet(int x, int y, int z, int val)sets the current field value at the specified coordinatesvoidSetAll(int val)sets all squares in current the field to the specified valueintXdim()intYdim()intZdim()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface HAL.Interfaces.Grid3D
ApplyHood, ApplyHood, ApplyHoodMapped, ApplyRectangle, BoundaryIs, ContainsValidI, ContainsValidI, ConvI, ConvXpt, ConvXsq, ConvYpt, ConvYsq, ConvZpt, ConvZsq, DispX, DispY, DispZ, Dist, DistSquared, GetHoodI, I, I, In, In, InWrap, InWrap, ItoX, ItoY, ItoZ, MapHood, MapHood, MapHood, MapHood, RandomHoodI, WrapI
-
-
-
-
Constructor Detail
-
Grid3Dint
public Grid3Dint(int xDim, int yDim, int zDim, boolean wrapX, boolean wrapY, boolean wrapZ)creates a new Grid3Dint of dimensions xDim by yDim by zDim without wraparound
-
Grid3Dint
public Grid3Dint(int xDim, int yDim, int zDim)creates a new Grid3Dint of dimensions xDim by yDim by zDim with optional wraparound
-
-
Method Detail
-
Get
public int Get(int i)
gets the current field value at the specified coordinates
-
Get
public int Get(int x, int y, int z)gets the current field value at the specified coordinates
-
Set
public void Set(int i, int val)sets the current field value at the specified index
-
Set
public void Set(int x, int y, int z, int val)sets the current field value at the specified coordinates
-
GetField
public int[] GetField()
returns the complete field as an array
-
Add
public void Add(int x, int y, int z, int val)adds to the current field value at the specified coordinates
-
Scale
public void Scale(int x, int y, int z, double val)multiplies the current field value at the specified coordinates
-
Scale
public void Scale(int i, double val)multiplies the current field value at the specified index
-
Add
public void Add(int i, int val)adds to the current field value at the specified index
-
BoundAll
public void BoundAll(int min, int max)Bounds all values in the current field between min and max
-
SetAll
public void SetAll(int val)
sets all squares in current the field to the specified value
-
AddAll
public void AddAll(int val)
adds specified value to all entries of the curr field
-
ScaleAll
public void ScaleAll(double val)
multiplies all entries in the field by the value
-
GetAvg
public int GetAvg()
gets the average value of all squares in the current field
-
-