Class RangeSeq

All Implemented Interfaces:
Iterable<Item>

public final class RangeSeq extends Seq
Range sequence, containing at least two integers.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • asc

      public final boolean asc
      Ascending/descending order.
  • Method Details

    • get

      public static Value get(long start, long size, boolean asc)
      Returns a value representation of the specified items.
      Parameters:
      start - start value
      size - size
      asc - ascending order
      Returns:
      resulting item or sequence
    • range

      public long[] range(boolean order)
      Returns the range as long values.
      Parameters:
      order - respect ascending/descending order
      Returns:
      minimum and maximum value (inclusive)
    • toJava

      public Object toJava()
      Description copied from class: Value
      Returns a Java representation of the value.
      Overrides:
      toJava in class Seq
      Returns:
      Java object
    • ebv

      public Item ebv(QueryContext qc, InputInfo ii) throws QueryException
      Description copied from class: Expr

      Checks if the effective boolean value can be computed for this expression:

      • If it yields an empty sequence, Bln.FALSE will be returned.
      • If it yields a single item, this item will be returned.
      • If it yields nodes, the first node will be returned.
      • Otherwise, an error will be raised.

      A single numeric item may later be evaluated as positional predicate.

      Specified by:
      ebv in class Expr
      Parameters:
      qc - query context
      ii - input info (required for Seq instances, which have no input info)
      Returns:
      item
      Throws:
      QueryException - query exception
    • itemAt

      public Int itemAt(long pos)
      Description copied from class: Value
      Returns the item at the given position in the value. The specified value must be lie within the valid bounds.
      Specified by:
      itemAt in class Value
      Parameters:
      pos - position
      Returns:
      item
    • subSeq

      protected Seq subSeq(long offset, long length, QueryContext qc)
      Description copied from class: Seq
      Returns a sub sequence of this value with the given start and length.
      Overrides:
      subSeq in class Seq
      Parameters:
      offset - offset (ge 0)
      length - number of items (1 lt length lt size())
      qc - query context
      Returns:
      sub sequence
    • insert

      public Value insert(long pos, Item item, QueryContext qc)
      Description copied from class: Seq
      Inserts an item at the given position into this sequence and returns the resulting sequence.
      Specified by:
      insert in class Seq
      Parameters:
      pos - position at which the item should be inserted, must be between 0 and Seq.size
      item - item to insert
      qc - query context
      Returns:
      resulting value
    • remove

      public Value remove(long pos, QueryContext qc)
      Description copied from class: Seq
      Removes the item at the given position in this sequence and returns the resulting sequence.
      Specified by:
      remove in class Seq
      Parameters:
      pos - position of the item to remove, must be between 0 and Seq.size - 1
      qc - query context
      Returns:
      resulting sequence
    • reverse

      public Value reverse(QueryContext qc)
      Description copied from class: Value
      Returns all items of this value in reverse order.
      Specified by:
      reverse in class Value
      Parameters:
      qc - query context
      Returns:
      items in reverse order
    • cache

      public void cache(boolean lazy, InputInfo ii)
      Description copied from class: Value
      Caches lazy values.
      Specified by:
      cache in class Value
      Parameters:
      lazy - lazy caching
      ii - input info
    • atomValue

      public Value atomValue(QueryContext qc, InputInfo ii)
      Description copied from class: Expr
      Evaluates the expression and returns the atomized items.
      Specified by:
      atomValue in class Expr
      Parameters:
      qc - query context
      ii - input info (only required by Seq instances, which have no input info)
      Returns:
      atomized item
    • atomSize

      public long atomSize()
      Description copied from class: Value
      Computes the number of atomized items.
      Specified by:
      atomSize in class Value
      Returns:
      atomized item
    • equals

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

      public String description()
      Description copied from class: ExprInfo
      Returns a string description of the expression. This method is only called by error messages. Contrary to the ExprInfo.toString() method, arguments are not included in the output.
      Overrides:
      description in class Seq
      Returns:
      result of check
    • plan

      public void plan(QueryPlan plan)
      Description copied from class: ExprInfo
      Creates a query plan.
      Overrides:
      plan in class Seq
      Parameters:
      plan - expression plan
    • plan

      public void plan(QueryString qs)
      Description copied from class: ExprInfo
      Creates a query string.
      Overrides:
      plan in class Seq
      Parameters:
      qs - query string builder