public static final class Formula.Literal extends Formula
Literals are the basic blocks of formulas. A literal holds exactly one integer value. If the value is positive, then the variable of that number is referenced. If it is negative, then the negation of the variable denoted by the absolute value is referenced.
0 is not allowed as a literal.
Formula.And, Formula.Equiv, Formula.Impl, Formula.Literal, Formula.Not, Formula.Or
Constructor and Description |
---|
Formula.Literal(int literal)
Instantiate a new literal.
|
Modifier and Type | Method and Description |
---|---|
int |
accept(FormulaVisitor visitor)
Entry point for a
FormulaVisitor . |
int |
getValue() |
int |
getVar() |
String |
toString()
Return a string representation of the object.
|
countSubFormulas, equals, getSubFormula, hashCode
public Formula.Literal(int literal) throws IllegalArgumentException
If literal
is positive, the object captures the variable of
that number. If it is negative, then the object captures the logical
negation of the variable -literal
0 is not allowed as parameter
literal
- the variable or negation of variableIllegalArgumentException
- if literal == 0
public int accept(FormulaVisitor visitor)
Formula
FormulaVisitor
.
This methods realises the accept-part of the visitor pattern.
public String toString()
Formula
Formulas are represented using unicode infix and prefix operators.
public int getValue()
public int getVar()