Class Math


  • public abstract class Math
    extends java.lang.Object
    This class implements extension functions in the http://exslt.org/math namespace.
    • Constructor Summary

      Constructors 
      Constructor Description
      Math()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double abs​(double x)
      Get the absolute value of a numeric value (SStL)
      static double acos​(double x)
      Get the arccosine of a numeric value (SStL)
      static double asin​(double x)
      Get the arcsine of a numeric value (SStL)
      static double atan​(double x)
      Get the arctangent of a numeric value (SStL)
      static double atan2​(double x, double y)
      Converts rectangular coordinates to polar (SStL)
      static double constant​(XPathContext context, java.lang.String name, double precision)
      Get a named constant to a given precision (SStL)
      static double cos​(double x)
      Get the cosine of a numeric value (SStL)
      static double exp​(double x)
      Get the exponential of a numeric value (SStL)
      static Sequence highest​(XPathContext context, SequenceIterator nsv)
      Get the items with maximum numeric value of the string-value of each of a sequence of items.
      static double log​(double x)
      Get the logarithm of a numeric value (SStL)
      static Sequence lowest​(XPathContext context, SequenceIterator nsv)
      Get the items with minimum numeric value of the string-value of each of a sequence of items The items are returned in the order of the original sequence.
      static double max​(XPathContext context, SequenceIterator nsv)
      Get the maximum numeric value of the string-value of each of a set of nodes
      static double min​(XPathContext context, SequenceIterator nsv)
      Get the minimum numeric value of the string-value of each of a set of nodes
      static NumericValue power​(NumericValue n, NumericValue e)
      Get a number n raised to the power of another number e.
      static double random()
      Get a random numeric value (SStL)
      static double sin​(double x)
      Get the sine of a numeric value (SStL)
      static double sqrt​(double x)
      Get the square root of a numeric value (SStL)
      static double tan​(double x)
      Get the tangent of a numeric value (SStL)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Math

        public Math()
    • Method Detail

      • max

        public static double max​(XPathContext context,
                                 SequenceIterator nsv)
                          throws XPathException
        Get the maximum numeric value of the string-value of each of a set of nodes
        Parameters:
        context - the XPath dynamic context
        nsv - the values whose maximum is required
        Throws:
        XPathException
      • min

        public static double min​(XPathContext context,
                                 SequenceIterator nsv)
                          throws XPathException
        Get the minimum numeric value of the string-value of each of a set of nodes
        Parameters:
        context - the XPath dynamic context
        nsv - the values whose minimum is required
        Throws:
        XPathException
      • highest

        public static Sequence highest​(XPathContext context,
                                       SequenceIterator nsv)
                                throws XPathException
        Get the items with maximum numeric value of the string-value of each of a sequence of items. The items are returned in the order of the original sequence.
        Parameters:
        context - the XPath dynamic context
        nsv - the input sequence
        Throws:
        XPathException
      • lowest

        public static Sequence lowest​(XPathContext context,
                                      SequenceIterator nsv)
                               throws XPathException
        Get the items with minimum numeric value of the string-value of each of a sequence of items The items are returned in the order of the original sequence.
        Parameters:
        context - the XPath dynamic context
        nsv - the input sequence
        Throws:
        XPathException
      • abs

        public static double abs​(double x)
        Get the absolute value of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • sqrt

        public static double sqrt​(double x)
        Get the square root of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • power

        public static NumericValue power​(NumericValue n,
                                         NumericValue e)
                                  throws XPathException
        Get a number n raised to the power of another number e.

        If e is a non-negative integer, then the result will have the same type as n, except that a float is always promoted to double.

        If e is a negative integer, then the result will have the same type as n except that a float is treated as a double and an integer is treated as a decimal.

        If e is not an integer (or an xs:decimal representing an integer), the result will be a double.

        Parameters:
        n - the first argument.
        e - the second argument. M
        Returns:
        the result of n^e
        Throws:
        XPathException - if an arithmetic overflow is detected. However, there is no guarantee that overflow will always be detected, it may (especially with double arithmetic) lead to wrong answers being returned.
      • constant

        public static double constant​(XPathContext context,
                                      java.lang.String name,
                                      double precision)
                               throws XPathException
        Get a named constant to a given precision (SStL)
        Parameters:
        context - the XPath dynamic context
        name - the name of the constant
        precision - the required precision
        Throws:
        XPathException
      • log

        public static double log​(double x)
        Get the logarithm of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • random

        public static double random()
        Get a random numeric value (SStL)
        Returns:
        the result
      • sin

        public static double sin​(double x)
        Get the sine of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • cos

        public static double cos​(double x)
        Get the cosine of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • tan

        public static double tan​(double x)
        Get the tangent of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • asin

        public static double asin​(double x)
        Get the arcsine of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • acos

        public static double acos​(double x)
        Get the arccosine of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • atan

        public static double atan​(double x)
        Get the arctangent of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result
      • atan2

        public static double atan2​(double x,
                                   double y)
        Converts rectangular coordinates to polar (SStL)
        Parameters:
        x - the first input value
        y - the second input value
        Returns:
        the result
      • exp

        public static double exp​(double x)
        Get the exponential of a numeric value (SStL)
        Parameters:
        x - the input value
        Returns:
        the result