|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sat4j.core.LiteralsUtils
public final class LiteralsUtils
Utility methods to avoid using bit manipulation inside code. One should use Java 1.5 import static feature to use it without class qualification inside the code. In the DIMACS format, the literals are represented by signed integers, 0 denoting the end of the clause. In the solver, the literals are represented by positive integers, in order to use them as index in arrays for instance.
int p : a literal (p>1) p ˆ 1 : the negation of the literal p >> 1 : the DIMACS number representing the variable. int v : a DIMACS variable (v>0) v << 1 : a positive literal for that variable in the solver. v << 1 ˆ 1 : a negative literal for that variable.
Method Summary | |
---|---|
static int |
neg(int p)
Returns the opposite literal. |
static int |
negLit(int var)
Returns the negative literal associated with a variable. |
static int |
posLit(int var)
Returns the positive literal associated with a variable. |
static int |
toDimacs(int p)
decode the internal representation of a literal in internal representation into Dimacs format. |
static int |
toInternal(int x)
encode the classical Dimacs representation (negated integers for negated literals) into the internal format. |
static int |
var(int p)
Returns the variable associated to the literal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int var(int p)
p
- a literal in internal representation
public static int neg(int p)
p
- a literal in internal representation
public static int posLit(int var)
var
- a variable in Dimacs format
public static int negLit(int var)
var
- a variable in Dimacs format
public static int toDimacs(int p)
p
- the literal in internal representation
public static int toInternal(int x)
x
- the literal in Dimacs format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |