Class Dbl

All Implemented Interfaces:
Iterable<Item>

public final class Dbl extends ANum
Double item (xs:double).
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • NAN

      public static final Dbl NAN
      Value "NaN".
    • ZERO

      public static final Dbl ZERO
      Value "0".
    • ONE

      public static final Dbl ONE
      Value "1".
  • Method Details

    • get

      public static Dbl get(double value)
      Returns an instance of this class.
      Parameters:
      value - value
      Returns:
      instance
    • get

      public static Dbl get(byte[] value, InputInfo ii) throws QueryException
      Returns an instance of this class.
      Parameters:
      value - value
      ii - input info
      Returns:
      instance
      Throws:
      QueryException - query exception
    • string

      public byte[] string()
      Description copied from class: ANum
      Returns a string representation of the value.
      Specified by:
      string in class ANum
      Returns:
      string value
    • bool

      public boolean bool(InputInfo ii)
      Description copied from class: Item
      Returns a boolean representation of the value.
      Overrides:
      bool in class Item
      Parameters:
      ii - input info (can be null)
      Returns:
      boolean value
    • itr

      public long itr()
      Description copied from class: ANum
      Returns an integer (long) representation of the value.
      Specified by:
      itr in class ANum
      Returns:
      long value
    • flt

      public float flt()
      Description copied from class: ANum
      Returns an float representation of the value.
      Specified by:
      flt in class ANum
      Returns:
      float value
    • dbl

      public double dbl()
      Description copied from class: ANum
      Returns an double representation of the value.
      Specified by:
      dbl in class ANum
      Returns:
      double value
    • dec

      public BigDecimal dec(InputInfo ii) throws QueryException
      Description copied from class: Item
      Returns a decimal representation of the value.
      Overrides:
      dec in class Item
      Parameters:
      ii - input info (can be null)
      Returns:
      decimal value
      Throws:
      QueryException - query exception
    • abs

      public Dbl abs()
      Description copied from class: ANum
      Returns an absolute value.
      Specified by:
      abs in class ANum
      Returns:
      absolute value
    • ceiling

      public Dbl ceiling()
      Description copied from class: ANum
      Returns an ceiling value.
      Specified by:
      ceiling in class ANum
      Returns:
      ceiling value
    • floor

      public Dbl floor()
      Description copied from class: ANum
      Returns an floor value.
      Specified by:
      floor in class ANum
      Returns:
      floor value
    • round

      public Dbl round(int scale, boolean even)
      Description copied from class: ANum
      Returns a rounded value.
      Specified by:
      round in class ANum
      Parameters:
      scale - scale
      even - half-to-even flag
      Returns:
      rounded value
    • eq

      public boolean eq(Item item, Collation coll, StaticContext sc, InputInfo ii) throws QueryException
      Description copied from class: Item
      Compares the items for equality.
      Specified by:
      eq in class Item
      Parameters:
      item - item to be compared
      coll - collation (can be null)
      sc - static context; required for comparing items of type xs:QName (can be null)
      ii - input info (can be null)
      Returns:
      result of check
      Throws:
      QueryException - query exception
    • diff

      public int diff(Item item, Collation coll, InputInfo ii) throws QueryException
      Description copied from class: Item
      Returns the difference between the current and the specified item. This function is overwritten by the corresponding implementations.
      Overrides:
      diff in class Item
      Parameters:
      item - item to be compared
      coll - collation (can be null)
      ii - input info (can be null)
      Returns:
      difference
      Throws:
      QueryException - query exception
    • toJava

      public Double toJava()
      Description copied from class: Value
      Returns a Java representation of the value.
      Specified by:
      toJava in class Value
      Returns:
      Java object
    • equals

      public boolean equals(Object obj)
      Description copied from class: Expr
      This function is e.g. called by:
      Specified by:
      equals in class Expr
    • parse

      public static double parse(byte[] value, InputInfo ii) throws QueryException
      Converts the given token into a double value.
      Parameters:
      value - value to be converted
      ii - input info
      Returns:
      double value
      Throws:
      QueryException - query exception