Module dev.metaschema.core
Class ArraySubarray
java.lang.Object
dev.metaschema.core.metapath.function.library.ArraySubarray
Implements the XPath 3.1 array:subarray
function.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ICollectionValue>
IArrayItem<T>subarray(IArrayItem<T> array, int start) An implementation of XPath 3.1 array:subarray.static <T extends ICollectionValue>
IArrayItem<T>subarray(IArrayItem<T> array, int start, int length) An implementation of XPath 3.1 array:subarray.static <T extends ICollectionValue>
IArrayItem<T>subarray(IArrayItem<T> array, IIntegerItem startItem) An implementation of XPath 3.1 array:subarray.static <T extends ICollectionValue>
IArrayItem<T>subarray(IArrayItem<T> array, IIntegerItem startItem, IIntegerItem lengthItem) An implementation of XPath 3.1 array:subarray.
-
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 arraystartItem- 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 arraystartItem- 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 negativeIndexOutOfBoundsArrayMetapathException- 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 arraystart- 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 arraystart- 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 negativeIndexOutOfBoundsArrayMetapathException- if the position of the start argument is not a value in the range of 1 to array:size
-