Class MathFunction

All Implemented Interfaces:
NamedExpression, HasSQL, Typed

public final class MathFunction extends Function1_2
A math function.
  • Field Details

  • Constructor Details

  • Method Details

    • getValue

      public Value getValue(SessionLocal session, Value v1, Value v2)
      Description copied from class: Function1_2
      Returns the value of this function.
      Overrides:
      getValue in class Function1_2
      Parameters:
      session - the session
      v1 - the value of first argument
      v2 - the value of second argument, or null
      Returns:
      the resulting value
    • round

      private Value round(Value v1, Value v2, RoundingMode roundingMode)
    • roundMagic

      private static double roundMagic(double d)
    • optimize

      public Expression optimize(SessionLocal session)
      Description copied from class: Expression
      Try to optimize the expression.
      Specified by:
      optimize in class Expression
      Parameters:
      session - the session
      Returns:
      the optimized expression
    • optimizeRoundWithScale

      private Expression optimizeRoundWithScale(SessionLocal session, boolean possibleRoundUp)
    • optimizeRound

      private Expression optimizeRound(int scale, boolean scaleIsKnown, boolean scaleIsNull, boolean possibleRoundUp)
      Optimizes rounding and truncation functions.
      Parameters:
      scale - the scale, if known
      scaleIsKnown - whether scale is known
      scaleIsNull - whether scale is NULL
      possibleRoundUp - true if result of rounding can have larger precision than precision of argument, false otherwise
      Returns:
      the optimized expression or null if this function should be used
    • getName

      public String getName()
      Description copied from interface: NamedExpression
      Get the name.
      Returns:
      the name in uppercase