Package fr.uga.pddl4j.util
Class IntMatrix
java.lang.Object
fr.uga.pddl4j.util.IntMatrix
- All Implemented Interfaces:
Serializable
This class implements a matrix at n-dimension. This class is used to store the predicates tables.
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorDescriptionIntMatrix(int size, int dimension)
Create a new n-dimensional matrix with a specified size and dimension. -
Method Summary
Modifier and TypeMethodDescriptionint
get(int[] index)
Get the integer at the specified index.int
Return the dimension of the matrix.int
getSize()
Return the size of the matrix.void
increment(int[] index)
Increment the value at a specified index.void
put(int[] index, int value)
Put a new value at a specified index.void
zero()
Set all the value of the matrix to 0.
-
Constructor Details
-
IntMatrix
public IntMatrix(int size, int dimension)Create a new n-dimensional matrix with a specified size and dimension.- Parameters:
size
- the size of the matrix.dimension
- the dimension of the matrix.- Throws:
IllegalArgumentException
- if size ≤ 0.
-
-
Method Details
-
get
public final int get(int[] index)Get the integer at the specified index.- Parameters:
index
- the index.- Returns:
- the integer contained in the matrix at the specified index or null if no element is at the specified index.
- Throws:
ArrayIndexOutOfBoundsException
- if index.length ≠ dimension and for all i 0 ≤ index[i] < size does not hold.
-
put
public final void put(int[] index, int value)Put a new value at a specified index.- Parameters:
index
- the index.value
- the integer value to put.- Throws:
ArrayIndexOutOfBoundsException
- if index.length ≠ dimension and for all i 0 ≤ index[i] < size does not hold.
-
increment
public final void increment(int[] index)Increment the value at a specified index.- Parameters:
index
- the index.- Throws:
ArrayIndexOutOfBoundsException
- if index.length ≠ dimension and for all i 0 ≤ index[i] < size does not hold.
-
zero
public final void zero()Set all the value of the matrix to 0. -
getDimension
public int getDimension()Return the dimension of the matrix.- Returns:
- the dimension of the matrix.
-
getSize
public final int getSize()Return the size of the matrix.- Returns:
- size the size of the matrix.
-