Class PedigreeArrayItem

All Implemented Interfaces:
PedigreeValue, Callable, FunctionItem, GroundedValue, Item, Sequence

public class PedigreeArrayItem extends DelegatingArrayItem implements PedigreeValue
A PedigreeArrayItem represents an XDM array together with a Pedigree: that is, retained information about how the array was selected with a JSON-like tree.
  • Constructor Details

    • PedigreeArrayItem

      public PedigreeArrayItem(ArrayItem base)
      Create a PedigreeArrayItem with an empty pedigree
      Parameters:
      base - the underlying array item
    • PedigreeArrayItem

      public PedigreeArrayItem(ArrayItem base, Pedigree pedigree)
      Create a PedigreeArrayItem with a known pedigree
      Parameters:
      base - the underlying array item
  • Method Details

    • get

      public GroundedValue get(int index)
      Get the member of the array at a specified index, retaining information about how that member was selected
      Overrides:
      get in class DelegatingArrayItem
      Parameters:
      index - the zero-based subscript of the selected member of the array
      Returns:
      the requested array member, which will itself have a pedigree if it is a singleton map or array.
      Throws:
      IndexOutOfBoundsException - if the index is out of bounds
    • remove

      public ArrayItem remove(int index)
      Get all members of the array except that at a specified position, retaining information about how the remaining members were selected
      Overrides:
      remove in class DelegatingArrayItem
      Parameters:
      index - the zero-based subscript of the member of the array that is to be removed
      Returns:
      the remaining array members, which will themselves have a pedigree (indicating their original position in the original array) in the case of members that are singleton maps or arrays.
      Throws:
      IndexOutOfBoundsException - if the index is out of bounds
    • subArray

      public ArrayItem subArray(int start, int end)
      Description copied from class: ArrayItem
      Get a sub-array given a start and end position
      Overrides:
      subArray in class DelegatingArrayItem
      Parameters:
      start - the start position (zero based)
      end - the end position (the position of the first item not to be returned) (zero based)
      Returns:
      a new array item containing the sub-array
    • members

      public Iterable<GroundedValue> members()
      Return the members of the array as an iterable collection
      Overrides:
      members in class DelegatingArrayItem
      Returns:
      the members of the array as an iterable collection. Any members that are singleton maps or arrays will have a pedigree indicating how they were selected.
    • getPedigree

      public Pedigree getPedigree()
      Get the pedigree of this array item, providing information as to how it was selected.
      Specified by:
      getPedigree in interface PedigreeValue
      Returns:
      the pedigree of this array item
    • getBaseItem

      public ArrayItem getBaseItem()
      Overrides:
      getBaseItem in class DelegatingArrayItem