Class TermSplit
java.lang.Object
org.projog.core.predicate.AbstractSingleResultPredicate
org.projog.core.predicate.builtin.construct.TermSplit
- All Implemented Interfaces:
KnowledgeBaseConsumer, PredicateFactory
atom_chars / atom_codes / number_chars / number_codes
atom_chars(A,L)compares the atomAto the list of charactersL.atom_codes(A,L)compares the atomAto the list of character codesL.number_chars(N,L)compares the numberNto the list of charactersL.number_codes(N,L)compares the numberNto the list of character codesL.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTermSplit(boolean firstArgNumeric, boolean convertToCharCodes) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidstatic TermSplitstatic TermSplitprotected TermcharToTerm(char c) protected booleanprivate booleanevaluateWithConcreteFirstArgument(Term arg1, Term arg2) Convertsarg1to a list and attempts to unify it witharg2.private booleanevaluateWithVariableFirstArgument(Term arg1, Term arg2) Convertsarg2from a list to an atom and attempts to unify it witharg1.private booleanprivate voidstatic TermSplitstatic TermSplitprivate charnumericToChar(long n) private charstringToChar(String name) private Numericprivate IntegerNumberprivate Numericprivate TermMethods inherited from class AbstractSingleResultPredicate
evaluate, evaluate, evaluate, evaluate, evaluate, getArithmeticOperators, getFileHandles, getKnowledgeBase, getOperands, getPredicate, getPredicates, getProjogListeners, getSpyPoints, getTermFormatter, init, isRetryable, setKnowledgeBaseMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PredicateFactory
isAlwaysCutOnBacktrack
-
Field Details
-
firstArgNumeric
private final boolean firstArgNumeric -
convertToCharCodes
private final boolean convertToCharCodes
-
-
Constructor Details
-
TermSplit
private TermSplit(boolean firstArgNumeric, boolean convertToCharCodes)
-
-
Method Details
-
atomChars
-
atomCodes
-
numberChars
-
numberCodes
-
evaluate
- Overrides:
evaluatein classAbstractSingleResultPredicate
-
evaluateWithVariableFirstArgument
Convertsarg2from a list to an atom and attempts to unify it witharg1.Example of a prolog query that would cause this method to be used:
?- number_chars(X, [1,4,2]). X = 142
- Parameters:
arg1- aVariablearg2- aList- Returns:
trueif was able to unify
-
evaluateWithConcreteFirstArgument
Convertsarg1to a list and attempts to unify it witharg2.Example of a prolog query that would cause this method to be used:
?- atom_chars(apple, X). X = [a,p,p,l,e]
- Parameters:
arg1- aAtomorNumericarg2- in order to unify, this argument must represent aAtomorList- Returns:
trueif was able to unify
-
isValidConcreteFirstArgument
-
isNotList
-
appendListElementsToString
-
stringToChar
-
charToTerm
-
numericToChar
private char numericToChar(long n) -
toTerm
-
toNumeric
-
toInteger
-
toDecimal
-