Class PredSort
- java.lang.Object
-
- org.projog.core.predicate.AbstractSingleResultPredicate
-
- org.projog.core.predicate.builtin.compare.PredSort
-
- All Implemented Interfaces:
KnowledgeBaseConsumer,PredicateFactory,PreprocessablePredicateFactory
public final class PredSort extends AbstractSingleResultPredicate implements PreprocessablePredicateFactory
predsort(X,Y,Z)- sorts a list using the specified predicate.Sorts the list represented by
Yusing the predicate represented byX- and attempts to unify the result withZ. The predicate represented byXmust indicate whether the second argument is equal, less than or greater than the third argument - by unifying the first argument with an atom which has the value=,<or>.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPredSort.PredSortComparatorprivate static classPredSort.PreprocessedPredSort
-
Field Summary
Fields Modifier and Type Field Description private static intFIRST_ARG_ARITYThe arity of the predicate represented by the first argument.
-
Constructor Summary
Constructors Constructor Description PredSort()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanevaluate(Term predicateName, Term input, Term sorted)private static booleanevaluatePredSort(PredicateFactory pf, Term predicateName, Term input, Term sorted)PredicateFactorypreprocess(Term term)-
Methods inherited from class org.projog.core.predicate.AbstractSingleResultPredicate
evaluate, evaluate, evaluate, evaluate, evaluate, getArithmeticOperators, getFileHandles, getKnowledgeBase, getOperands, getPredicate, getPredicates, getProjogListeners, getSpyPoints, getTermFormatter, init, isRetryable, setKnowledgeBase
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.projog.core.predicate.PredicateFactory
getPredicate, isAlwaysCutOnBacktrack, isRetryable
-
-
-
-
Field Detail
-
FIRST_ARG_ARITY
private static final int FIRST_ARG_ARITY
The arity of the predicate represented by the first argument.- See Also:
- Constant Field Values
-
-
Method Detail
-
evaluate
protected boolean evaluate(Term predicateName, Term input, Term sorted)
- Overrides:
evaluatein classAbstractSingleResultPredicate
-
evaluatePredSort
private static boolean evaluatePredSort(PredicateFactory pf, Term predicateName, Term input, Term sorted)
-
preprocess
public PredicateFactory preprocess(Term term)
- Specified by:
preprocessin interfacePreprocessablePredicateFactory
-
-