This module defines a class rneg_c.
Its objects represent default negations in rules.
They basically consist of a list of literals
(where the literals are considered as conjunctively connected).
However,
if the default negation should be ground (i.e. not contain variables),
a pointer to the corresponding gneg_c
-object is stored in addition.
The class gneg_c represents ground default negations
that appear in conditional facts.
It is more efficient to compute the ground default negation only once
and store it in this object
instead of doing this every time the rule is applied.
And input specifications that do not use variables
should not pay the price for them.
Note that there are actually three different classes for default negations:
Actually,
objects of this class represent lists of default negations
since they contain a pointer to the next default negation
in the same rule.
Earlier,
I had a separate class for lists of default negations
(called rnegs_c
),
but since each rneg_c
-object
belongs only to a single rule
this was an unncessary complication of the code.
In addition,
the method for getting the first list element
was called get_head
(in the sense of head vs. tail),
which was quite confusing
("head" is also head of a rule).
rneg_c(lit_t *lits, rvars_t vars);
;vars
,
they are automatically added.
However,
any such variable is unsafe
(violates the allowedness/range-restriction condition).
Therefore these variables are also added to the set of unsafe variables,
see unsafe_c).
bool_t is_ground(void) const
;BOOL_TRUE
if the default negation is ground,
i.e. does not contain any variables.
In this case,
get_neg
can be used (see below).
rlits_t get_lits(void) const
;gneg_t get_gneg(void) const
;gneg_c
-object
corresponding to this default negation.
It can only be used if this default negation
does not contain any variables.
rneg_c* get_next(void) const
;void set_next(rneg_c* next)
;void print(rvars_t vars) const
;void print_list(rvars_t vars) const
;