Class ArithmeticOperators


  • public final class ArithmeticOperators
    extends java.lang.Object
    Maintains a collection of 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 Detail

      • ArithmeticOperators

        public ArithmeticOperators​(KnowledgeBase kb)
    • Method Detail

      • getNumeric

        public Numeric getNumeric​(Term t)
        Returns the result of evaluating the specified arithmetic expression.
        Parameters:
        t - a Term that can be evaluated as an arithmetic expression (e.g. a Structure of the form +(1,2) or a Numeric)
        Returns:
        the result of evaluating the specified arithmetic expression
        Throws:
        ProjogException - if the specified term does not represent an arithmetic expression
      • getPreprocessedArithmeticOperator

        public ArithmeticOperator getPreprocessedArithmeticOperator​(Term argument)
        Returns:
        null if not found
      • instantiateArithmeticOperator

        private ArithmeticOperator instantiateArithmeticOperator​(java.lang.String className)