Package org.jacop.jasat.utils
Class Utils
java.lang.Object
org.jacop.jasat.utils.Utils
Contains utils for arrays manipulation
- Version:
- 4.10
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final Integer[]
static final <E> Set<E>[]
static int
not
(int i) given a positive var, returns the literal that represents the negation of the variable variable -> literalstatic final int[][]
resize
(int[][] array, int newSize) resize for int[][]static final int[][]
resize
(int[][] array, int newSize, int size) the same, but with the number of elements to copy from old liststatic final int[]
resize
(int[] array, int newSize, int size, MemoryPool pool) Resize the array to newSize, using the given memory poolstatic final int[]
resize
(int[] array, int newSize, MemoryPool pool) static String
showClause
(int[] clause) facility to print a clause to a stringstatic int
var
(int i) get the "absolute value" of the int (the variable that corresponds to the literal) literal -> variable
-
Field Details
-
MASK
private static final int MASK- See Also:
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
resize
Resize the array to newSize, using the given memory pool- Parameters:
array
- the array to resizenewSize
- the size of the new arraysize
- the number of elements to copy from @param arraypool
- the MemoryPool from which to find an int[]- Returns:
- a new int[] with required size, and elements from @param array
-
resize
-
resize
public static final int[][] resize(int[][] array, int newSize) resize for int[][]- Parameters:
array
- the array to resizenewSize
- the size of the array we want- Returns:
- a new array which first elements are the same as the ones in array
-
resize
public static final int[][] resize(int[][] array, int newSize, int size) the same, but with the number of elements to copy from old list- Parameters:
array
- array to be extendednewSize
- new size for the arraysize
- the number of elements to copy from the old- Returns:
- a new array which first elements are the same as the ones in array
-
ensure
-
ensure
-
showClause
facility to print a clause to a string- Parameters:
clause
- the clause to print- Returns:
- a nice representation of the clause
-
var
public static int var(int i) get the "absolute value" of the int (the variable that corresponds to the literal) literal -> variable- Parameters:
i
- the literal- Returns:
- the variable
-
not
public static int not(int i) given a positive var, returns the literal that represents the negation of the variable variable -> literal- Parameters:
i
- the variable- Returns:
- the negated variable
-