public final class ArithmeticOperators extends Object
ArithmeticOperator instances.
This class provides a mechanism for "plugging in" or "injecting" implementations of ArithmeticOperator at
runtime. This mechanism provides an easy way to configure and extend the arithmetic operations supported by Projog.
Each KnowledgeBase has a single unique ArithmeticOperators instance.
| Constructor and Description |
|---|
ArithmeticOperators(KnowledgeBase kb) |
| Modifier and Type | Method and Description |
|---|---|
void |
addArithmeticOperator(PredicateKey key,
ArithmeticOperator operator)
Associates a
ArithmeticOperator with this KnowledgeBase. |
void |
addArithmeticOperator(PredicateKey key,
String operatorClassName)
Associates a
ArithmeticOperator with this KnowledgeBase. |
ArithmeticOperator |
getArithmeticOperator(PredicateKey key) |
Numeric |
getNumeric(Term t)
Returns the result of evaluating the specified arithmetic expression.
|
ArithmeticOperator |
getPreprocessedArithmeticOperator(Term argument) |
public ArithmeticOperators(KnowledgeBase kb)
public void addArithmeticOperator(PredicateKey key, ArithmeticOperator operator)
ArithmeticOperator with this KnowledgeBase.key - The name and arity to associate the ArithmeticOperator with.operator - The instance of ArithmeticOperator to be associated with key.ProjogException - if there is already a ArithmeticOperator associated with the PredicateKeypublic void addArithmeticOperator(PredicateKey key, String operatorClassName)
ArithmeticOperator with this KnowledgeBase.key - The name and arity to associate the ArithmeticOperator with.operatorClassName - The class name of the ArithmeticOperator to be associated with key.ProjogException - if there is already a ArithmeticOperator associated with the PredicateKeypublic Numeric getNumeric(Term t)
t - a Term that can be evaluated as an arithmetic expression (e.g. a Structure of the form
+(1,2) or a Numeric)ProjogException - if the specified term does not represent an arithmetic expressionpublic ArithmeticOperator getPreprocessedArithmeticOperator(Term argument)
public ArithmeticOperator getArithmeticOperator(PredicateKey key)
ProjogException - if not foundCopyright © 2024. All rights reserved.