java.lang.Object
dev.metaschema.core.metapath.function.library.ArraySubarray

public final class ArraySubarray extends Object
Implements the XPath 3.1 array:subarray function.
  • Method Details

    • subarray

      @NonNull public static <T extends ICollectionValue> IArrayItem<T> subarray(@NonNull IArrayItem<T> array, @NonNull IIntegerItem startItem)
      An implementation of XPath 3.1 array:subarray.
      Type Parameters:
      T - the type of items in the given Metapath array
      Parameters:
      array - the target Metapath array
      startItem - the integer position of the item to start with (inclusive)
      Returns:
      a new array item consisting of the items in the identified range
      Throws:
      IndexOutOfBoundsArrayMetapathException - if the start position is not in the range of 1 to array:size
    • subarray

      @NonNull public static <T extends ICollectionValue> IArrayItem<T> subarray(@NonNull IArrayItem<T> array, @NonNull IIntegerItem startItem, @NonNull IIntegerItem lengthItem)
      An implementation of XPath 3.1 array:subarray.
      Type Parameters:
      T - the type of items in the given Metapath array
      Parameters:
      array - the target Metapath array
      startItem - the integer position of the item to start with (inclusive)
      lengthItem - the integer count of items to include starting with the item at the start position
      Returns:
      a new array item consisting of the items in the identified range
      Throws:
      NegativeLengthArrayMetapathException - if the length is negative
      IndexOutOfBoundsArrayMetapathException - if the start position is not in the range of 1 to array:size
    • subarray

      @NonNull public static <T extends ICollectionValue> IArrayItem<T> subarray(@NonNull IArrayItem<T> array, int start)
      An implementation of XPath 3.1 array:subarray.
      Type Parameters:
      T - the type of items in the given Metapath array
      Parameters:
      array - the target Metapath array
      start - the integer position of the item to start with (inclusive)
      Returns:
      a new array item consisting of the items in the identified range
      Throws:
      IndexOutOfBoundsArrayMetapathException - if the start position is not in the range of 1 to array:size
    • subarray

      @NonNull public static <T extends ICollectionValue> IArrayItem<T> subarray(@NonNull IArrayItem<T> array, int start, int length)
      An implementation of XPath 3.1 array:subarray.
      Type Parameters:
      T - the type of items in the given Metapath array
      Parameters:
      array - the target Metapath array
      start - the integer position of the item to start with (inclusive)
      length - the integer count of items to include starting with the item at the start position
      Returns:
      a new array item consisting of the items in the identified range
      Throws:
      NegativeLengthArrayMetapathException - if the length argument is negative
      IndexOutOfBoundsArrayMetapathException - if the position of the start argument is not a value in the range of 1 to array:size