Package HAL.GridsAndAgents
Class Grid2Dlong
- java.lang.Object
-
- HAL.GridsAndAgents.Grid2Dlong
-
- All Implemented Interfaces:
Grid2D
,java.io.Serializable
public class Grid2Dlong extends java.lang.Object implements Grid2D, java.io.Serializable
a 2D Grid of longs- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Grid2Dlong(int xDim, int yDim)
creates a new Grid2Dlong of dimensions xDim by yDim without wraparoundGrid2Dlong(int xDim, int yDim, boolean wrapX, boolean wrapY)
creates a new Grid2Dlong of dimensions xDim by yDim with optional wraparound
-
Method Summary
Modifier and Type Method Description void
Add(int x, int y, long val)
adds to the current field value at the specified coordinatesvoid
Add(int i, long val)
adds to the current field value at the specified indexvoid
AddAll(long val)
adds specified value to all entries of the curr fieldvoid
BoundAll(long min, long max)
Bounds all values in the current field between min and maxlong
Get(int i)
gets the current field value at the specified indexlong
Get(int x, int y)
gets the current field value at the specified coordinateslong
GetAvg()
gets the average value of all squares in the current fieldlong[]
GetField()
returns the complete field as an arraylong
GetMax()
returns the max value in the gridlong
GetMin()
returns the min value in the gridboolean
IsWrapX()
boolean
IsWrapY()
int
Length()
void
Scale(int i, double val)
multiplies the current field value at the specified indexvoid
Scale(int x, int y, double val)
multiplies the current field value at the specified coordinatesvoid
ScaleAll(double val)
adds specified value to all entries of the curr fieldvoid
Set(int x, int y, long val)
sets the current field value at the specified coordinatesvoid
Set(int i, long val)
sets the current field value at the specified indexvoid
SetAll(long val)
sets all squares in current the field to the specified valuevoid
SetAll(long[] vals)
int
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
-
-
-
-
Method Detail
-
Get
public long Get(int i)
gets the current field value at the specified index
-
GetField
public long[] GetField()
returns the complete field as an array
-
Get
public long Get(int x, int y)
gets the current field value at the specified coordinates
-
Set
public void Set(int i, long val)
sets the current field value at the specified index
-
Set
public void Set(int x, int y, long val)
sets the current field value at the specified coordinates
-
Add
public void Add(int x, int y, long val)
adds to the current field value at the specified coordinates
-
Scale
public void Scale(int x, int y, 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, long val)
adds to the current field value at the specified index
-
BoundAll
public void BoundAll(long min, long max)
Bounds all values in the current field between min and max
-
SetAll
public void SetAll(long val)
sets all squares in current the field to the specified value
-
AddAll
public void AddAll(long val)
adds specified value to all entries of the curr field
-
ScaleAll
public void ScaleAll(double val)
adds specified value to all entries of the curr field
-
SetAll
public void SetAll(long[] vals)
-
GetAvg
public long GetAvg()
gets the average value of all squares in the current field
-
GetMax
public long GetMax()
returns the max value in the grid
-
GetMin
public long GetMin()
returns the min value in the grid
-
-