Class AbstractArithmeticOperator

    • Constructor Detail

      • AbstractArithmeticOperator

        public AbstractArithmeticOperator()
    • Method Detail

      • setKnowledgeBase

        public final void setKnowledgeBase​(KnowledgeBase kb)
        Provides a reference to a KnowledgeBase.

        Meaning this object will always have access to a KnowledgeBase by the time its calculate method is invoked.

        Specified by:
        setKnowledgeBase in interface KnowledgeBaseConsumer
      • calculate

        public final Numeric calculate​(Term[] args)
        Description copied from interface: ArithmeticOperator
        Returns the result of the calculation using the specified arguments.
        Specified by:
        calculate in interface ArithmeticOperator
        Parameters:
        args - the arguments to use in the calculation
        Returns:
        the result of the calculation using the specified arguments
      • createWrongNumberOfArgumentsException

        private java.lang.IllegalArgumentException createWrongNumberOfArgumentsException​(int numberOfArguments)
      • isPure

        protected boolean isPure()
        Indicates if this operator is pure and so can be preprocessed.

        An operator is pure if multiple calls with identical arguments always produce the same result.

        Returns:
        true if pure and so can be preprocessed, else false