public abstract class AbstractPredicateFactory extends Object implements PredicateFactory, KnowledgeBaseConsumer
Constructor and Description |
---|
AbstractPredicateFactory() |
Modifier and Type | Method and Description |
---|---|
protected ArithmeticOperators |
getArithmeticOperators() |
protected FileHandles |
getFileHandles() |
protected KnowledgeBase |
getKnowledgeBase() |
protected Operands |
getOperands() |
protected Predicate |
getPredicate() |
protected Predicate |
getPredicate(Term arg) |
Predicate |
getPredicate(Term[] args)
Returns a
Predicate to be used in the evaluation of a goal. |
protected Predicate |
getPredicate(Term arg1,
Term arg2) |
protected Predicate |
getPredicate(Term arg1,
Term arg2,
Term arg3) |
protected Predicate |
getPredicate(Term arg1,
Term arg2,
Term arg3,
Term arg4) |
protected Predicates |
getPredicates() |
protected ProjogListeners |
getProjogListeners() |
protected SpyPoints |
getSpyPoints() |
protected TermFormatter |
getTermFormatter() |
protected void |
init()
This method is called by
setKnowledgeBase(KnowledgeBase) . |
boolean |
isRetryable()
Should instances of this implementation be re-evaluated when backtracking?
|
void |
setKnowledgeBase(KnowledgeBase knowledgeBase)
Provides a reference to a
KnowledgeBase . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isAlwaysCutOnBacktrack
public final Predicate 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()
protected Predicate getPredicate()
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
otherwisepublic final void setKnowledgeBase(KnowledgeBase knowledgeBase)
KnowledgeBaseConsumer
KnowledgeBase
.setKnowledgeBase
in interface KnowledgeBaseConsumer
protected void init()
setKnowledgeBase(KnowledgeBase)
.
Can be overridden by subclasses to perform initialisation before any calls to getPredicate(Term[])
are
made. As setKnowledgeBase(KnowledgeBase)
will have already been called before this method is invoked,
overridden versions will be able to access the KnowledgeBase
using getKnowledgeBase()
.
protected final KnowledgeBase getKnowledgeBase()
protected final Predicates getPredicates()
protected final ArithmeticOperators getArithmeticOperators()
protected final ProjogListeners getProjogListeners()
protected final Operands getOperands()
protected final TermFormatter getTermFormatter()
protected final SpyPoints getSpyPoints()
protected final FileHandles getFileHandles()
Copyright © 2024. All rights reserved.