public final class InterpretedTailRecursivePredicateFactory extends Object implements PredicateFactory
Each instance of InterpretedTailRecursivePredicateFactory
creates new instances of
InterpretedTailRecursivePredicate
for a specific user defined predicate. The user defined predicate must be
judged as eligible for tail recursion optimisation using the criteria used by
TailRecursivePredicateMetaData
.
Constructor and Description |
---|
InterpretedTailRecursivePredicateFactory(KnowledgeBase kb,
TailRecursivePredicateMetaData metaData) |
Modifier and Type | Method and Description |
---|---|
org.projog.core.predicate.udp.InterpretedTailRecursivePredicate |
getPredicate(Term[] args)
Returns a
Predicate to be used in the evaluation of a goal. |
boolean |
isRetryable()
Should instances of this implementation be re-evaluated when backtracking?
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isAlwaysCutOnBacktrack
public InterpretedTailRecursivePredicateFactory(KnowledgeBase kb, TailRecursivePredicateMetaData metaData)
public org.projog.core.predicate.udp.InterpretedTailRecursivePredicate getPredicate(Term[] args)
PredicateFactory
Predicate
to be used in the evaluation of a goal.getPredicate
in interface PredicateFactory
args
- the arguments to use in the evaluation of the goalPredicate.evaluate()
public boolean isRetryable()
PredicateFactory
Some goals (e.g. X is 1
) are only meant to be evaluated once (the statement is either true or false) while
others (e.g. repeat(3)
) are meant to be evaluated multiple times. For instances of Predicate
that
are designed to possibly have Predicate.evaluate()
called on them multiple times for the same individual
query this method should return true
. For instances of Predicate
that are designed to only be
evaluated once per individual query this method should return false
.
isRetryable
in interface PredicateFactory
true
if an attempt should be made to re-evaluate instances of implementing classes when
backtracking, false
otherwiseCopyright © 2024. All rights reserved.