Package HAL.GridsAndAgents
Class Grid1Dlong
- java.lang.Object
-
- HAL.GridsAndAgents.Grid1Dlong
-
- All Implemented Interfaces:
Grid1D,java.io.Serializable
public class Grid1Dlong extends java.lang.Object implements Grid1D, java.io.Serializable
a 1D Grid of longs- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Grid1Dlong(int xDim)creates a new Grid1Dlong of length xDim without wraparoundGrid1Dlong(int xDim, boolean wrapX)creates a new Grid1Dlong of length xDim with optional wraparound
-
Method Summary
Modifier and Type Method Description voidAdd(int x, long val)adds to the current field value at the specified indexvoidAddAll(long val)adds specified value to all entries of the curr fieldvoidBoundAll(long min, long max)Bounds all values in the current field between min and maxlongGet(int x)gets the current field value at the specified indexlongGetAvg()returns the mean value of the gridlong[]GetField()returns the complete field as an arraylongGetMax()returns the max value in the gridlongGetMin()returns the min value in the gridbooleanIsWrapX()intLength()voidScale(int x, long val)multiplies the current field value at the specified indexvoidScaleAll(long val)adds specified value to all entries of the curr fieldvoidSet(int x, long val)sets the current field value at the specified indexvoidSetAll(long val)sets all squares in current the field to the specified valuevoidSetAll(long[] vals)copies the array argument into the fieldintXdim()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface HAL.Interfaces.Grid1D
ApplyHood, ApplyHoodMapped, ApplyRectangle, ContainsValidI, DispX, Dist, DistSquared, GetHoodI, In, In, InWrap, InWrap, MapHood, MapHood, MapXpt, MapXsq, RandomHoodI, WrapI
-
-
-
-
Method Detail
-
Get
public long Get(int x)
gets the current field value at the specified index
-
GetField
public long[] GetField()
returns the complete field as an array
-
Set
public void Set(int x, long val)sets the current field value at the specified index
-
Scale
public void Scale(int x, long val)multiplies the current field value at the specified index
-
Add
public void Add(int x, 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(long val)
adds specified value to all entries of the curr field
-
SetAll
public void SetAll(long[] vals)
copies the array argument into the field
-
GetAvg
public long GetAvg()
returns the mean value of the grid
-
GetMax
public long GetMax()
returns the max value in the grid
-
GetMin
public long GetMin()
returns the min value in the grid
-
-