Package org.jacop.jasat.utils
Class Utils
- java.lang.Object
-
- org.jacop.jasat.utils.Utils
-
public final class Utils extends java.lang.ObjectContains utils for arrays manipulation- Version:
- 4.8
-
-
Field Summary
Fields Modifier and Type Field Description private static intMASK
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Integer[]ensure(java.lang.Integer[] array, int size)static <E> java.util.Set<E>[]ensure(java.util.HashSet<E>[] array, int size)static intnot(int i)given a positive var, returns the literal that represents the negation of the variable variable -> literalstatic int[][]resize(int[][] array, int newSize)resize for int[][]static int[][]resize(int[][] array, int newSize, int size)the same, but with the number of elements to copy from old liststatic int[]resize(int[] array, int newSize, int size, MemoryPool pool)Resize the array to newSize, using the given memory poolstatic int[]resize(int[] array, int newSize, MemoryPool pool)static java.lang.StringshowClause(int[] clause)facility to print a clause to a stringstatic intvar(int i)get the "absolute value" of the int (the variable that corresponds to the literal) literal -> variable
-
-
-
Field Detail
-
MASK
private static final int MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
resize
public static final int[] resize(int[] array, int newSize, int size, MemoryPool pool)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
public static final int[] resize(int[] array, int newSize, MemoryPool pool)
-
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
public static final java.lang.Integer[] ensure(java.lang.Integer[] array, int size)
-
ensure
public static final <E> java.util.Set<E>[] ensure(java.util.HashSet<E>[] array, int size)
-
showClause
public static java.lang.String showClause(int[] clause)
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
-
-