Class LiteralID¶
- Defined in File structures.h
Class Documentation¶
-
class
LiteralID
¶ Public Functions
-
LiteralID
()¶ Initializes the literal to negated and ID 0.
-
LiteralID
(int lit)¶ Converts a literal number into a literal ID. The absolute value of the passed literal ID is the variable number. The sign represents whether the literal is negated or non-negated.
- Parameters
lit
: Literal ID with a negative number representing a negated literal
-
LiteralID
(VariableIndex var, bool sign)¶ Build a literal from the variable ID and a sign term.
- Parameters
var
: Variable identification number.sign
: true for a positive literal and false for a negative literal
-
VariableIndex
var
() const¶ Gets the variable identification number associated with the literal. It ignores the literal’s sign (i.e., negation/positive)
- Return
- Variable ID number
-
int
toInt
() const¶ Converts the literal into the form (sign)VariableNumber where sign is +/- depending whether the literal is negated.
- Return
- Signed version of the variable number.
-
void
inc
()¶ Increments the literal ID number. This may cause a negated literal to become positive or cause a positive literal’s ID to become the next negated literal.
-
void
copyRaw
(unsigned int v)¶ Sets the literal ID to the processed value. It does not process its integrity or correctness.
- Parameters
v
: New literal value
-
const bool
sign
() const¶ Returns whether the literal is positive or negated.
- Return
- True if the literal is positive (i.e., unnegated)
-
const LiteralID
neg
() const¶ Creates a literal that has the opposite sign as the current literal. For example, if the implicit literal is negated, this returns a positive/unnegated literal. If it is positive, this function returns a negated literal.
- Return
- LiteralID of this literal just negated.
-
void
print
() const¶
-
unsigned
raw
() const¶ Accesses the raw value of how the literal is stored in the data structure.
- Return
- Unmodified verison of the data structure value
-