Interface UserDefinedPredicateFactory
- All Superinterfaces:
PredicateFactory
- All Known Implementing Classes:
DynamicUserDefinedPredicateFactory, StaticUserDefinedPredicateFactory, TabledUserDefinedPredicateFactory
Maintains a record of the clauses that define a user defined predicate.

A user defined predicate is a predicate that is constructed from Prolog syntax consulted at runtime.

-
Method Summary
Modifier and TypeMethodDescriptionvoidaddFirst(ClauseModel clauseModel) Adds a clause to the beginning of the predicate's list of clauses.voidaddLast(ClauseModel clauseModel) Adds a clause to the end of the predicate's list of clauses.voidcompile()getClauseModel(int index) Returns the clause at the specified position in this predicate's list of clauses.Returns an iterator over the clauses in the predicate in proper sequence.Returns the key for the predicate this object representsbooleanReturnstrueis this predicate is dynamic.Methods inherited from interface PredicateFactory
getPredicate, isAlwaysCutOnBacktrack, isRetryable, preprocess
-
Method Details
-
addFirst
Adds a clause to the beginning of the predicate's list of clauses.- Parameters:
clauseModel- the clause to add to the beginning of the predicate
-
addLast
Adds a clause to the end of the predicate's list of clauses.- Parameters:
clauseModel- the clause to add to the end of the predicate
-
getPredicateKey
PredicateKey getPredicateKey()Returns the key for the predicate this object represents- Returns:
- the key for the predicate this object represents
-
getImplications
Iterator<ClauseModel> getImplications()Returns an iterator over the clauses in the predicate in proper sequence.- Returns:
- an iterator over the clauses in the predicate in proper sequence.
-
isDynamic
boolean isDynamic()Returnstrueis this predicate is dynamic.A "dynamic" predicate is a user defined predicate that can have clauses added or removed after is first defined.
- Returns:
trueis this predicate is dynamic
-
getClauseModel
Returns the clause at the specified position in this predicate's list of clauses.- Parameters:
index- index of the clause to return- Returns:
- the clause at the specified position in this predicate's list of clauses or
nullif out of bounds
-
compile
void compile()
-