Class Flag
- java.lang.Object
-
- org.projog.core.predicate.AbstractSingleResultPredicate
-
- org.projog.core.predicate.builtin.kb.Flag
-
- All Implemented Interfaces:
KnowledgeBaseConsumer,PredicateFactory
public final class Flag extends AbstractSingleResultPredicate
flag(X,Y,Z)- associates a key with a value.The first argument must be an atom or structure. The name and arity of the first argument is used to construct the key. The second argument is the value currently associated with the key. If there is not currently a value associated with the key then it will default to 0. The third argument is the new value to associate with the key. The third argument must be a numeric value.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<PredicateKey,Numeric>flags
-
Constructor Summary
Constructors Constructor Description Flag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanevaluate(Term key, Term oldValue, Term newValue)private NumericgetOrCreate(PredicateKey pk)private voidput(PredicateKey pk, Term value)-
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
isAlwaysCutOnBacktrack
-
-
-
-
Field Detail
-
flags
private final java.util.Map<PredicateKey,Numeric> flags
-
-
Method Detail
-
evaluate
protected boolean evaluate(Term key, Term oldValue, Term newValue)
- Overrides:
evaluatein classAbstractSingleResultPredicate
-
getOrCreate
private Numeric getOrCreate(PredicateKey pk)
-
put
private void put(PredicateKey pk, Term value)
-
-