Class Average

    • Field Detail

      • add

        protected Add add
        Function used to add pairs of elements
      • div

        protected Divide div
        Function used to divide sum of elements by the number of elements
    • Constructor Detail

      • Average

        public Average​(Add add,
                       Divide div)
      • Average

        public Average()
    • Method Detail

      • calc

        protected java.lang.Object calc​(java.util.List<java.lang.Object> v)
                                 throws EvaluationException
        Called by the run method, default is to call average(List) but subclasses can override.
        Specified by:
        calc in class ArrayFunctionBase
        Parameters:
        v - a list of objects to calculate the average of.
        Returns:
        result of calculation
        Throws:
        EvaluationException - if the calculation cannot be performed
        Since:
        3.4.0
      • average

        public java.lang.Object average​(java.util.List<java.lang.Object> vals)
                                 throws EvaluationException
        Returns the average of a set of values. Depends on the Add and Divide classes to perform the calculation.
        Parameters:
        vals - Values to be averaged
        Returns:
        the average of the values
        Throws:
        EvaluationException - if the calculation cannot be performed
      • evaluate

        public double evaluate​(double val)
        Just returns its argument.
        Specified by:
        evaluate in interface RealUnaryFunction