[SLP-Homepage]
[Source Modules]
[Manual]
[Run]
[Examples]
Argument Term in a Formula
This module defines a class term_c.
The objects of this class correspond to argument terms in input formulas.
Argument terms can be constants (symbolic constants/atoms or integers),
variables,
and anonymous variables.
Note that there are other classes for argument terms in facts
(which can be only constants) (class farg_c),
and for argument terms in rules
(which need a distinction between the first/binding occurence of a variable
and other/bound occurrences) (class rarg_c).
Construction:
The constructor for this class is overloaded
corresponding to the different kinds of terms:
- Constructor from Variable:
-
term_c(var_t var)
;
This method creates a new argument term that is a variable.
- Constructor from Constant (Ground Term):
-
term_c(cnst_t cnst)
;
This method creates a new argument term that is a constant,
i.e. a ground term.
Currently constants are either symbolic constants (atoms)
or integers,
see cnst_c
.
- Constructor for Anonymous Variable:
-
term_c(void)
;
This method creates a new argument term that is an anonymous variable.
Object Methods:
- is_var:
-
bool_t is_var(void) const
;
This method returns BOOL_TRUE
if this term is a (non-anonymous) variable.
Otherwise it returns BOOL_FALSE
.
- is_anon:
-
bool_t is_anon(void) const
;
This method returns BOOL_TRUE
if this term is an anonymous variable.
Otherwise it returns BOOL_FALSE
.
- is_atom:
-
bool_t is_cnst(void) const
;
This method returns BOOL_TRUE
if this term is a constant (i.e. ground).
Otherwise it returns BOOL_FALSE
.
- get_var:
-
var_t get_var(void) const
;
This method may only be called if this term is a variable.
It then returns a pointer to the variable
(an object of class var_c).
- get_cnst:
-
cnst_t get_cnst(void) const
;
This method may only be called if this term is a constant
(ground).
It then returns a pointer to the constant
(an object of class cnst_c
).
- print:
-
void print(void) const
;
This method prints the term.
Implementation:
Stefan Brass
(sbrass@sis.pitt.edu),
October 10, 2001.
[HTML 3.2 Checked]