Package HAL.GridsAndAgents
Class Grid2Dobject<T>
- java.lang.Object
-
- HAL.GridsAndAgents.Grid2Dobject<T>
-
- All Implemented Interfaces:
Grid2D
,java.io.Serializable
public class Grid2Dobject<T> extends java.lang.Object implements Grid2D, java.io.Serializable
a 2D Grid of objects- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Grid2Dobject(int xDim, int yDim)
creates a new Grid2Dobject of dimensions xDim by yDim without wraparoundGrid2Dobject(int xDim, int yDim, boolean wrapX, boolean wrapY)
creates a new Grid2Dobject of dimensions xDim by yDim with optional wraparound
-
Method Summary
Modifier and Type Method Description T
Get(int i)
gets the current field value at the specified indexT
Get(int x, int y)
gets the current field value at the specified coordinatesT[]
GetField()
boolean
IsWrapX()
boolean
IsWrapY()
int
Length()
void
Set(int x, int y, T val)
sets the current field value at the specified coordinatesvoid
Set(int i, T val)
sets the current field value at the specified indexvoid
SetAll(T val)
sets all squares in the field to the specified valuevoid
SetAll(T[] vals)
copies the array of values into the fieldint
Xdim()
int
Ydim()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface HAL.Interfaces.Grid2D
AlongLineIs, ApplyHood, ApplyHood, ApplyHoodMapped, ApplyRectangle, BoundaryIs, ContainsValidI, ContainsValidI, DispX, DispY, Dist, DistSquared, GetHoodI, I, I, In, In, InWrap, ItoX, ItoY, MapHood, MapHood, MapHood, MapHood, MapI, MapXpt, MapXsq, MapYpt, MapYsq, RandomHoodI, WrapI
-
-
-
-
Constructor Detail
-
Grid2Dobject
public Grid2Dobject(int xDim, int yDim)
creates a new Grid2Dobject of dimensions xDim by yDim without wraparound
-
Grid2Dobject
public Grid2Dobject(int xDim, int yDim, boolean wrapX, boolean wrapY)
creates a new Grid2Dobject of dimensions xDim by yDim with optional wraparound
-
-
Method Detail
-
Get
public T Get(int i)
gets the current field value at the specified index
-
GetField
public T[] GetField()
-
Get
public T Get(int x, int y)
gets the current field value at the specified coordinates
-
Set
public void Set(int i, T val)
sets the current field value at the specified index
-
Set
public void Set(int x, int y, T val)
sets the current field value at the specified coordinates
-
SetAll
public void SetAll(T val)
sets all squares in the field to the specified value
-
SetAll
public void SetAll(T[] vals)
copies the array of values into the field
-
-