Class MinMax

  • All Implemented Interfaces:
    PostfixMathCommandI, java.io.Serializable

    public class MinMax
    extends ArrayFunctionBase
    Minimum and Maximum functions. Initialize with true for minimum and false for maximum. Since Jep 3.4 this function will flatten its arguments so min([1,[2,3]]) will be 1.
    Since:
    3.1.0
    See Also:
    Serialized Form
    • Field Detail

      • comp

        protected Comparative comp
        Used to compare greater than or less than between objects.
    • Constructor Detail

      • MinMax

        public MinMax​(boolean isMin)
        Constructor.
        Parameters:
        isMin - set to true for Minimum, false for Maximum
      • MinMax

        public MinMax​(Comparative comp)
        Constructor allowing for a different Comparative object. The Comparative.compare(Object, Object) method will be used to compare elements.
        Parameters:
        comp - a Comparative object or subclass implemented less than or greater than.
        Since:
        3.4.0
    • Method Detail

      • calc

        protected java.lang.Object calc​(java.util.List<java.lang.Object> v)
                                 throws EvaluationException
        Description copied from class: ArrayFunctionBase
        Abstract method for performing the array calculation.
        Specified by:
        calc in class ArrayFunctionBase
        Parameters:
        v - The list to operate on. Note this is in reverse order of the arguments of the function.
        Returns:
        The result of the calculation.
        Throws:
        EvaluationException - if the calculation cannot be performed
      • getComp

        public Comparative getComp()
        Return the Comparative objected used to order the objects.
        Returns:
        the Comparative object
        Since:
        3.4.0