public interface _MetaBacktrackRule extends _AbstractRule
A meta-backtrack rule specifies an enumeration of backtrack
rules to try in the proof-search. An instance of a meta backtrack-rule
is successful if at least one of the backtrack rules is
successful. The sequence of backtrack rules is provided as an enumeration
implemented by the methods nextRule()
and hasNextRule()
.
totalNumberOfRules()
returns a value grater than zero;nextRule()
can be safely invoked at least once returning a
non null value.nextRule()
to get the new rule to apply, then it invokes
hasNextRule()
to check if the enumeration of the rules contains more
elements. If this is the case the engine stores the rule application in its
internal stack as an OR-branch point.
When a branch in the proof-search fails, the engine searches the stack for an
OR-branch-point. If the stack does not contain any backtrack point, the
engine stops and the proof-search is unsuccessful. Otherwise, the rule
application stored in the OR-branch point is restored. If the rule
application is an instance of _MetaBacktrackRule
, then the engine
invokes nextRule()
to determine the next rule to apply. Then the
engine invokes hasNextRule()
to check if the enumeration of rules
has more elements. If this is the case the engine keeps the OR-branch point
in the stack otherwise it pop the OR-branch point from the stack.Modifier and Type | Method and Description |
---|---|
_AbstractGoal |
goal()
Returns the goal of this meta-backtrack rule application.
|
boolean |
hasNextRule()
Returns true if this metabacktrack rule has a next rule.
|
_AbstractRule |
nextRule()
Returns the next rule.
|
int |
totalNumberOfRules()
Returns the total number of backtrack-rules provided by this rule
application.
|
name
_AbstractGoal goal()
int totalNumberOfRules()
_AbstractRule nextRule() throws NoSuchBacktrackRuleException
NoSuchBacktrackRuleException
- if no rule existsboolean hasNextRule()