public interface ArrayItem extends Function
Modifier and Type | Field and Description |
---|---|
static SequenceType |
SINGLE_ARRAY_TYPE |
Modifier and Type | Method and Description |
---|---|
int |
arrayLength()
Get the number of members in the array
|
ArrayItem |
concat(ArrayItem other)
Concatenate this array with another
|
GroundedValue<?> |
get(int index)
Get a member of the array
|
default Genre |
getGenre()
Get the genre of this item
|
SequenceType |
getMemberType(TypeHierarchy th)
Get the lowest common item type of the members of the array
|
ArrayItem |
insert(int position,
GroundedValue<?> member)
Insert a new member into an array
|
boolean |
isEmpty()
Ask whether the array is empty
|
java.lang.Iterable<GroundedValue<?>> |
members()
Get the list of all members of the array
|
ArrayItem |
put(int index,
GroundedValue<?> newValue)
Replace a member of the array
|
ArrayItem |
remove(int index)
Remove a member from the array
|
ArrayItem |
removeSeveral(IntSet positions)
Remove zero or more members from the array
|
ArrayItem |
subArray(int start,
int end)
Get a sub-array given a start and end position
|
default java.lang.String |
toShortString()
Provide a short string showing the contents of the item, suitable
for use in error messages
|
argumentArray, call, deepEquals, export, getAnnotations, getArity, getDescription, getFunctionItemType, getFunctionName, getOperandRoles, isArray, isMap, isTrustedResultType, makeNewContext
atomize, getLength, getStringValue, getStringValueCS, head, isStreamed, itemAt, iterate, iterator, reduce, subsequence, toGroundedValue
asIterable, effectiveBooleanValue, materialize
makeRepeatable
static final SequenceType SINGLE_ARRAY_TYPE
GroundedValue<?> get(int index) throws XPathException
index
- the position of the member to retrieve (zero-based)XPathException
- if the index is out of rangeArrayItem put(int index, GroundedValue<?> newValue) throws XPathException
index
- the position of the member to replace (zero-based)newValue
- the replacement valueXPathException
- if the index is out of rangeint arrayLength()
Note: the method always returns 1, because an array is an item
boolean isEmpty()
java.lang.Iterable<GroundedValue<?>> members()
ArrayItem concat(ArrayItem other)
other
- the second arrayArrayItem remove(int index)
index
- the position of the member to be removed (zero-based)java.lang.IndexOutOfBoundsException
- if index is out of rangeArrayItem removeSeveral(IntSet positions)
positions
- the positions of the members to be removed (zero-based).
A value that is out of range is ignored.ArrayItem subArray(int start, int end)
start
- the start position (zero based)end
- the end position (the position of the first item not to be returned)
(zero based)java.lang.IndexOutOfBoundsException
- if start, or start+end, is out of rangeArrayItem insert(int position, GroundedValue<?> member)
position
- the 0-based position that the new item will assumemember
- the new member to be insertedjava.lang.IndexOutOfBoundsException
- if position is out of rangeSequenceType getMemberType(TypeHierarchy th)
default java.lang.String toShortString()
toShortString
in interface Function
toShortString
in interface GroundedValue<Function>
toShortString
in interface Item<Function>
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.