Interface PredicateFactory
- All Known Subinterfaces:
UserDefinedPredicateFactory
- All Known Implementing Classes:
AbstractPredicateFactory, AbstractSingleResultPredicate, AddArithmeticOperator, AddExpressionFactory, AddPredicateFactory, AddUserDefinedArithmeticOperator, AlterSpyPoint, Append, AppendListOfLists, Arg, Assert, AtomConcat, AtomicListConcat, BagOf, Between, BooleanConstraintPredicate, Call, CharType, Close, Compare, Conjunction, Consult, ConsultList, ConvertTime, CopyTerm, CurrentInput, CurrentOutput, CurrentPredicate, Cut, Debugging, Delete, Dif, Disjunction, Distinct, Dynamic, DynamicUserDefinedPredicateFactory, EnsureLoaded, Equal, Erase, ExtremumList, Fail, FindAll, Flag, Flatten, Fold, Functor, GetChar, GetCode, GetTime, IfThen, In, InsertRecord, Inspect, InterpretedTailRecursivePredicateFactory, Is, IsAtom, IsAtomic, IsCompound, IsFloat, IsInteger, IsList, IsNonVar, IsNumber, IsVar, KeySort, Last, Length, Limit, Listing, MapList, Member, MemberCheck, NewLine, NoDebug, Not, NoTrace, NotStrictEquality, NotUnifiable, Nth, NumberVars, NumericConstraintPredicate, NumericEquality, NumericGreaterThan, NumericGreaterThanOrEqual, NumericInequality, NumericLessThan, NumericLessThanOrEqual, Once, Op, Open, PairsElements, PredSort, PutChar, RandomPermutation, Read, Recorded, RepeatInfinitely, RepeatSetAmount, Resolve, RetractAll, Reverse, See, Seen, Select, SetInput, SetOf, SetOutput, Sort, SortAsSet, StaticUserDefinedPredicateFactory, StrictEquality, SubList, Subset, SubtractFromList, SumList, Tab, TabledUserDefinedPredicateFactory, Tabling, Tell, TermGreaterThan, TermGreaterThanOrEqual, TermLessThan, TermLessThanOrEqual, TermSplit, Throw, Told, Trace, True, UnifyWithOccursCheck, Univ, UnknownPredicate, Write, WriteCanonical, Writef
public interface PredicateFactory
Returns specialised implementations of
Predicate.
There are two general types of predicates:
- User defined predicates are defined by a mixture of rules and facts constructed from Prolog syntax consulted at runtime.
- Built-in predicates are written in Java. Built-in predicates can provide facilities that would not be
possible using pure Prolog syntax. The two predicates that are always available in Projog are
pj_add_predicate/2andpj_add_arithmetic_operator/2. Thepj_add_predicate/2predicate allows other predicates to be "plugged-in" to Projog.
Note: Rather than directly implementing PredicateFactory it is recommended to extend either
AbstractSingleResultPredicate or
AbstractPredicateFactory.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetPredicate(Term term) Returns aPredicateto be used in the evaluation of a goal.default booleanWill attempting to re-evaluate this implementation always result in a cut?booleanShould instances of this implementation be re-evaluated when backtracking?default PredicateFactorypreprocess(Term term)
-
Method Details
-
getPredicate
-
isRetryable
boolean isRetryable()Should instances of this implementation be re-evaluated when backtracking?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 ofPredicatethat are designed to possibly havePredicate.evaluate()called on them multiple times for the same individual query this method should returntrue. For instances ofPredicatethat are designed to only be evaluated once per individual query this method should returnfalse.- Returns:
trueif an attempt should be made to re-evaluate instances of implementing classes when backtracking,falseotherwise
-
isAlwaysCutOnBacktrack
default boolean isAlwaysCutOnBacktrack()Will attempting to re-evaluate this implementation always result in a cut?- Returns:
trueif a cut will always be encountered when attempting to re-evaluate,falseotherwise
-
preprocess
-