dlvhex
2.5.0
|
String-based Atom object (comfort interface). More...
#include <include/dlvhex2/ComfortPluginInterface.h>
Public Member Functions | |
const std::string & | toString () const |
Return string representation (cached). | |
bool | operator< (const ComfortAtom &other) const |
Compare atoms. | |
std::ostream & | print (std::ostream &o) const |
Print atom (using ostream_printable<T>). | |
const std::string & | getPredicate () const |
Return predicate symbol. | |
const ComfortTuple | getArguments () const |
Return arguments of the atom as ComfortTerm. | |
const ComfortTerm | getArgument (int index) const |
Return a single argument of the atom as ComfortTerm. | |
unsigned | getArity () const |
Retrieves the arity of the atom. | |
unsigned | isStrongNegated () const |
Checks if the atom is a strongly negated one. | |
void | setArgument (int index, ComfortTerm arg) |
Reassignes an argument of the atom. | |
void | setArguments (ComfortTuple args) |
Reassignes all arguments of the atom. | |
ComfortAtom () | |
Constructor. | |
ComfortAtom (ComfortTerm pred, ComfortTuple args, bool stronglyNegated=false) | |
Constructor. | |
bool | unifiesWith (const ComfortAtom &other) const |
Check whether one atom unifies with another one. | |
Data Fields | |
ComfortTuple | tuple |
Content of the atom, represented as tuple. | |
Protected Member Functions | |
void | calculateStrVal () const |
Calculate cached string representation. | |
Protected Attributes | |
std::string | strval |
Cached string representation. |
String-based Atom object (comfort interface).
This atom object stores atoms consisting of ComfortTerms.
You can stream instances of this class into std::ostream&.
Note that strong negation, e.g., `-a' or `-b(c,d)' currently has undefined behavior with comfort interface, as strong negation is implemented as a plugin with auxiliaries.
Definition at line 280 of file ComfortPluginInterface.h.
ComfortAtom::ComfortAtom | ( | ) | [inline] |
Constructor.
Definition at line 386 of file ComfortPluginInterface.h.
ComfortAtom::ComfortAtom | ( | ComfortTerm | pred, |
ComfortTuple | args, | ||
bool | stronglyNegated = false |
||
) | [inline] |
Constructor.
pred | Predicate. args Arguments. |
True | to create a strongly negated atom. |
Definition at line 392 of file ComfortPluginInterface.h.
void ComfortAtom::calculateStrVal | ( | ) | const [protected] |
Calculate cached string representation.
Definition at line 139 of file ComfortPluginInterface.cpp.
const ComfortTerm ComfortAtom::getArgument | ( | int | index | ) | const [inline] |
Return a single argument of the atom as ComfortTerm.
index | Index of the argument to retrieve. |
index
of the atom as ComfortTerm. Definition at line 343 of file ComfortPluginInterface.h.
const ComfortTuple ComfortAtom::getArguments | ( | ) | const [inline] |
Return arguments of the atom as ComfortTerm.
Definition at line 330 of file ComfortPluginInterface.h.
unsigned ComfortAtom::getArity | ( | ) | const [inline] |
Retrieves the arity of the atom.
Arity | of the atom. |
Definition at line 351 of file ComfortPluginInterface.h.
const std::string& ComfortAtom::getPredicate | ( | ) | const [inline] |
Return predicate symbol.
Definition at line 320 of file ComfortPluginInterface.h.
unsigned ComfortAtom::isStrongNegated | ( | ) | const [inline] |
Checks if the atom is a strongly negated one.
Definition at line 358 of file ComfortPluginInterface.h.
References ComfortTerm::strval.
bool ComfortAtom::operator< | ( | const ComfortAtom & | other | ) | const [inline] |
Compare atoms.
We require this for storing ComfortAtom in sets.
other | Atom to compare to. |
other
and false otherwise. Definition at line 304 of file ComfortPluginInterface.h.
References tuple.
std::ostream & ComfortAtom::print | ( | std::ostream & | o | ) | const |
Print atom (using ostream_printable<T>).
Non-virtual on purpose. (see Printhelpers.h)
o | Stream to print to. |
o
. Definition at line 160 of file ComfortPluginInterface.cpp.
References toString().
void ComfortAtom::setArgument | ( | int | index, |
ComfortTerm | arg | ||
) | [inline] |
Reassignes an argument of the atom.
index | Index of the argument to reassign. |
arg | New value. |
Definition at line 368 of file ComfortPluginInterface.h.
void ComfortAtom::setArguments | ( | ComfortTuple | args | ) | [inline] |
Reassignes all arguments of the atom.
args | New values. |
Definition at line 375 of file ComfortPluginInterface.h.
const std::string& ComfortAtom::toString | ( | ) | const [inline] |
Return string representation (cached).
Definition at line 294 of file ComfortPluginInterface.h.
Referenced by print().
bool ComfortAtom::unifiesWith | ( | const ComfortAtom & | other | ) | const |
Check whether one atom unifies with another one.
other | Atom to compare to. |
other
and false otherwise. Definition at line 66 of file ComfortPluginInterface.cpp.
References DBGLOG, DBGLOG_SCOPE, printvector(), and tuple.
std::string ComfortAtom::strval [mutable, protected] |
Cached string representation.
Definition at line 412 of file ComfortPluginInterface.h.
Referenced by calculateStrVal().
Content of the atom, represented as tuple.
First term is predicate, other terms are arguments.
Definition at line 288 of file ComfortPluginInterface.h.
Referenced by calculateStrVal(), operator<(), TestCAtom::retrieve(), ComfortPluginAtom::retrieve(), TestSetMinusAtom::retrieve(), and unifiesWith().