Class SubSeq

All Implemented Interfaces:
Iterable<Item>

public final class SubSeq extends Seq
A sequence that defines a sub-range of another sequence.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Method Details

    • 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
    • itemAt

      public Item 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
    • 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
    • cache

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

      public Value atomValue(QueryContext qc, InputInfo ii) throws QueryException
      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
      Throws:
      QueryException - query exception
    • atomSize

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