pl_search_cpp 1.4
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
pl_search::NotNot Class Reference

Represents an equivalent of the Prolog call \+\+Call. The aim is to determine if Call succeeds without binding any variables in the call. More...

#include <pred.hpp>

Inheritance diagram for pl_search::NotNot:
Inheritance graph
[legend]
Collaboration diagram for pl_search::NotNot:
Collaboration graph
[legend]

Public Member Functions

 NotNot (Engine *eng, PredPtr p)
 Create the equivalent of Prolog's \+\+p call.
 
void initialize_call () override
 Initializes the call for the not-not predicate.
 
bool apply_choice () override
 Applies a choice for the not-not predicate.
 
bool more_choices () override
 Checks if there are more choices for the not-not predicate.
 
- Public Member Functions inherited from pl_search::Pred
 Pred (Engine *eng)
 Default constructor.
 
PredPtr get_continuation ()
 Gets the continuation of the predicate.
 
virtual void set_continuation (PredPtr cont)
 Sets the continuation of the predicate.
 
PredPtr last_pred ()
 Follows the continuation chain to the last predicate.
 
bool is_non_det ()
 Determines if the predicate is non-deterministic.
 
void wrap_with_once ()
 Wraps the predicate with a once.
 
virtual ~Pred ()=default
 Virtual destructor for proper cleanup.
 
std::string get_name ()
 For debugging.
 

Protected Attributes

PredPtr pred
 
bool succeeded
 
bool another_choice
 
PredPtr saved_continuation
 
- Protected Attributes inherited from pl_search::Pred
PredPtr continuation
 The continuation of the predicate.
 
Engineengine
 

Detailed Description

Represents an equivalent of the Prolog call \+\+Call. The aim is to determine if Call succeeds without binding any variables in the call.

Constructor & Destructor Documentation

◆ NotNot()

pl_search::NotNot::NotNot ( Engine eng,
PredPtr  p 
)
inline

Create the equivalent of Prolog's \+\+p call.

Parameters
engPointer to the engine.
pis the predicate called within NotNot.

Member Function Documentation

◆ apply_choice()

bool pl_search::NotNot::apply_choice ( )
overridevirtual

Applies a choice for the not-not predicate.

Returns
True if the choice is applied successfully, false otherwise.

< simply succeed for the first choice

< for the second choice we test if we reached NotNotEnd if so then the call of NotNot succeeded and so we move to the next predicate.

Reimplemented from pl_search::Pred.

◆ initialize_call()

void pl_search::NotNot::initialize_call ( )
overridevirtual

Initializes the call for the not-not predicate.

Reimplemented from pl_search::Pred.

◆ more_choices()

bool pl_search::NotNot::more_choices ( )
overridevirtual

Checks if there are more choices for the not-not predicate.

Returns
True if there are more choices, false otherwise.

< only two choices

Reimplemented from pl_search::Pred.

Member Data Documentation

◆ another_choice

bool pl_search::NotNot::another_choice
protected

◆ pred

PredPtr pl_search::NotNot::pred
protected

◆ saved_continuation

PredPtr pl_search::NotNot::saved_continuation
protected

◆ succeeded

bool pl_search::NotNot::succeeded
protected

The documentation for this class was generated from the following files: