public class SimpleArrayItem extends AbstractArrayItem implements ArrayItem
Modifier and Type | Field and Description |
---|---|
static SimpleArrayItem |
EMPTY_ARRAY
Static constant value representing an empty array
|
SINGLE_ARRAY_TYPE
Constructor and Description |
---|
SimpleArrayItem(java.util.List<GroundedValue<?>> members)
Construct an array whose members are arbitrary sequences
|
Modifier and Type | Method and Description |
---|---|
int |
arrayLength()
Get the size of the array
|
ArrayItem |
concat(ArrayItem other)
Concatenate this array with another
|
GroundedValue<?> |
get(int index)
Get a member of the array
|
AnnotationList |
getAnnotations()
Get the function annotations (as defined in XQuery).
|
java.util.List<GroundedValue<?>> |
getMembers()
Get a list of the members of the array
|
OperandRole[] |
getOperandRoles()
Get the roles of the arguments, for the purposes of streaming
|
ArrayItem |
insert(int position,
GroundedValue<?> member)
Insert a new member into an array
|
boolean |
isArray()
Ask whether this function item is an array
|
boolean |
isEmpty()
Ask whether the array is empty
|
boolean |
isMap()
Ask whether this function item is a map
|
void |
makeGrounded()
Ensure that all the members are grounded.
|
static SimpleArrayItem |
makeSimpleArrayItem(SequenceIterator<?> input)
Construct an array whose members are single items
|
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 pos)
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 subarray given a start and end position
|
java.lang.String |
toShortString()
Provide a short string showing the contents of the item, suitable
for use in error messages
|
atomize, call, deepEquals, effectiveBooleanValue, export, getArity, getDescription, getFunctionItemType, getFunctionName, getMemberType, getStringValue, getStringValueCS, isTrustedResultType, makeNewContext, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGenre, getMemberType
argumentArray, call, deepEquals, export, getArity, getDescription, getFunctionItemType, getFunctionName, isTrustedResultType, makeNewContext
atomize, getLength, getStringValue, getStringValueCS, head, isStreamed, itemAt, iterate, iterator, reduce, subsequence, toGroundedValue
asIterable, effectiveBooleanValue, materialize
makeRepeatable
public static final SimpleArrayItem EMPTY_ARRAY
public SimpleArrayItem(java.util.List<GroundedValue<?>> members)
members
- the list of values (in general, each value is a sequence) to form the members of the array.
The values must be repeatable sequences (not LazySequences); this is not checked.public static SimpleArrayItem makeSimpleArrayItem(SequenceIterator<?> input) throws XPathException
input
- an iterator over the items to make up the arrayXPathException
- if evaluating the SequenceIterator failspublic OperandRole[] getOperandRoles()
getOperandRoles
in interface Function
getOperandRoles
in class AbstractArrayItem
public void makeGrounded() throws XPathException
XPathException
public boolean isArray()
isArray
in interface Function
isArray
in class AbstractArrayItem
public boolean isMap()
isMap
in interface Function
isMap
in class AbstractArrayItem
public AnnotationList getAnnotations()
getAnnotations
in interface Function
getAnnotations
in class AbstractArrayItem
public GroundedValue<?> get(int index) throws XPathException
get
in interface ArrayItem
index
- the position of the member to retrieve (zero-based)XPathException
- if the index is out of rangepublic ArrayItem put(int index, GroundedValue newValue) throws XPathException
put
in interface ArrayItem
index
- the position of the member to replace (zero-based)newValue
- the replacement valueXPathException
- if the index is out of rangepublic int arrayLength()
arrayLength
in interface ArrayItem
public boolean isEmpty()
public java.lang.Iterable<GroundedValue<?>> members()
public ArrayItem removeSeveral(IntSet positions)
removeSeveral
in interface ArrayItem
positions
- the positions of the members to be removed (zero-based).
A value that is out of range is ignored.public ArrayItem remove(int pos)
public ArrayItem subArray(int start, int end)
subArray
in interface ArrayItem
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 rangepublic ArrayItem insert(int position, GroundedValue<?> member)
public java.util.List<GroundedValue<?>> getMembers()
public java.lang.String toShortString()
toShortString
in interface ArrayItem
toShortString
in interface Function
toShortString
in interface GroundedValue<Function>
toShortString
in interface Item<Function>
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.