Package uk.co.rafilevy.utils.ValueGrid
Class MutableIntGrid<A,B>
- java.lang.Object
-
- uk.co.rafilevy.utils.ValueGrid.ValueGrid<A,B,java.lang.Integer>
-
- uk.co.rafilevy.utils.ValueGrid.MutableIntGrid<A,B>
-
- Type Parameters:
A
- The row label typeB
- The column label type
public class MutableIntGrid<A,B> extends ValueGrid<A,B,java.lang.Integer>
MutableIntGrid is a ValueGrid containing integer values with some methods aiding mutation of values in the grid
-
-
Constructor Summary
Constructors Constructor Description MutableIntGrid()
Constructs a new empty MutableIntGrid Null value is set to 0MutableIntGrid(int nullValue)
Constructs a new empty MutableIntGrid with a specified null value
-
Method Summary
Modifier and Type Method Description void
add(A a, B b, int value)
Adds a value to the item in rowa
columnb
void
divide(A a, B b, int value)
Divides (Integer division) the item in rowa
columnb
by a specified valuevoid
modulo(A a, B b, int value)
Gives the remainder the item in rowa
columnb
when divided by a specified valuevoid
multiply(A a, B b, int value)
Multiplies the item in rowa
columnb
by a specified valuevoid
subtract(A a, B b, int value)
Subtracts a value from the item in rowa
columnb
-
Methods inherited from class uk.co.rafilevy.utils.ValueGrid.ValueGrid
containsColumn, containsRow, get, getColumn, getColumns, getRow, getRows, isEmpty, set, size, toString
-
-
-
-
Method Detail
-
add
public void add(A a, B b, int value)
Adds a value to the item in rowa
columnb
- Parameters:
a
- the row to be modifiedb
- the column to be modifiedvalue
- the value to be added to the specified item
-
subtract
public void subtract(A a, B b, int value)
Subtracts a value from the item in rowa
columnb
- Parameters:
a
- the row to be modifiedb
- the column to be modifiedvalue
- the value to be subtracted from the specified item
-
multiply
public void multiply(A a, B b, int value)
Multiplies the item in rowa
columnb
by a specified value- Parameters:
a
- the row to be modifiedb
- the column to be modifiedvalue
- the value to multiply the specified item by
-
divide
public void divide(A a, B b, int value)
Divides (Integer division) the item in rowa
columnb
by a specified value- Parameters:
a
- the row to be modifiedb
- the column to be modifiedvalue
- the value to divide the specified item by
-
-