public class Clause extends Object
concat(int)
which result in new clauses without
changing the receiver of the method call.Constructor and Description |
---|
Clause(int... literals)
Instantiates a new clause from a list of literals.
|
Modifier and Type | Method and Description |
---|---|
Clause |
concat(int literal)
Get a clause that represents this clause augmented by an additional
literal.
|
static List<Clause> |
exactlySetN(int n,
int v1,
int v2,
int v3,
int v4)
create a list of dimacs clauses to express that exactly
n
of 4 variables are set to true. |
int |
getMaxVar()
Get the largest index of all literals in the clause.
|
int[] |
toArray()
Extract the integer values of this clause into an array.
|
String |
toString()
A clause is textually represented as a list in square brackets.
|
public Clause(int... literals) throws IllegalArgumentException
literals
- a list of zero or more literal integers (different from 0)IllegalArgumentException
- iff the list of literals contains the value 0.public Clause concat(int literal) throws IllegalArgumentException
literal
- the additional literalliteral
.IllegalArgumentException
- if the arguments is 0public String toString()
public int[] toArray()
public int getMaxVar()
public static List<Clause> exactlySetN(int n, int v1, int v2, int v3, int v4)
n
of 4 variables are set to true.
The resulting list is a freshly created list of Clauses.n
- the number of variables that have to be true. 0 <=
n
<= 4v1
- a dimacs variable, > 0v2
- a dimacs variable, > 0v3
- a dimacs variable, > 0v4
- a dimacs variable, > 0