Class FnSum

Direct Known Subclasses:
FnAvg

public class FnSum extends StandardFunc
Function implementation.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • FnSum

      public FnSum()
  • Method Details

    • item

      public Item item(QueryContext qc, InputInfo ii) throws QueryException
      Description copied from class: Expr
      Evaluates the expression and returns the resulting item, or Empty.VALUE if the expression yields an empty sequence. If this method is not implemented, Expr.value(QueryContext) must be implemented instead.
      Overrides:
      item in class ParseExpr
      Parameters:
      qc - query context
      ii - input info (only required by Seq instances, which have no input info)
      Returns:
      item or Empty.VALUE
      Throws:
      QueryException - query exception
    • opt

      protected Expr opt(CompileContext cc) throws QueryException
      Description copied from class: StandardFunc
      Performs function specific optimizations.
      Overrides:
      opt in class StandardFunc
      Parameters:
      cc - compilation context
      Returns:
      optimized or original expression
      Throws:
      QueryException - query exception
    • simplifyArgs

      protected final void simplifyArgs(CompileContext cc)
      Description copied from class: StandardFunc
      Simplifies the types of all arguments. This function is overwritten by functions that rely on the original argument type.
      Overrides:
      simplifyArgs in class StandardFunc
      Parameters:
      cc - compilation context
    • range

      protected final Item range(Value value, boolean avg) throws QueryException
      Compute result from range value.
      Parameters:
      value - sequence
      avg - calculate average
      Returns:
      result, or null if sequence is empty
      Throws:
      QueryException - query exception
    • singleton

      protected final Item singleton(SingletonSeq seq, boolean avg) throws QueryException
      Compute result from singleton value.
      Parameters:
      seq - singleton sequence
      avg - calculate average
      Returns:
      result, or null if value cannot be evaluated
      Throws:
      QueryException - query exception