Class Int

All Implemented Interfaces:
Iterable<Item>

public final class Int extends ANum
Integer item (xs:int, xs:integer, xs:short, etc.).
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • MAX

      public static final Int MAX
      Maximum values.
    • ZERO

      public static final Int ZERO
      Value 0.
    • ONE

      public static final Int ONE
      Value 1.
  • Constructor Details

    • Int

      public Int(long value, Type type)
      Constructor.
      Parameters:
      value - value
      type - item type
  • Method Details

    • get

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

      public static Int get(long value, Type type)
      Returns an instance of this class.
      Parameters:
      value - value
      type - item type
      Returns:
      instance
    • 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
    • test

      public Item test(QueryContext qc, InputInfo ii)
      Description copied from class: Expr
      Performs a predicate test and returns the item if the test was successful. The returned item is required for full-text scoring.
      Overrides:
      test in class ANum
      Parameters:
      qc - query context
      ii - input info (required for Seq instances, which have no input info)
      Returns:
      item or null
    • dec

      public BigDecimal dec(InputInfo ii)
      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
    • abs

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

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

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

      public ANum 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 Object 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 long parse(Item item, InputInfo ii) throws QueryException
      Converts the given item to a long primitive.
      Parameters:
      item - item to be converted
      ii - input info
      Returns:
      long value
      Throws:
      QueryException - query exception