public class ImmutableArrayItem extends AbstractArrayItem
SINGLE_ARRAY_TYPE
Constructor and Description |
---|
ImmutableArrayItem(SimpleArrayItem other) |
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
|
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 subarray given a start and end position
|
atomize, call, deepEquals, effectiveBooleanValue, export, getAnnotations, getArity, getDescription, getFunctionItemType, getFunctionName, getMemberType, getOperandRoles, getStringValue, getStringValueCS, isArray, isMap, isTrustedResultType, makeNewContext, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGenre, toShortString
argumentArray
getLength, head, isStreamed, itemAt, iterate, reduce, subsequence, toGroundedValue
asIterable, concatenate, containsNode, materialize
makeRepeatable
public ImmutableArrayItem(SimpleArrayItem other)
public GroundedValue get(int index)
index
- the position of the member to retrieve (zero-based)java.lang.IndexOutOfBoundsException
- if the index is out of rangepublic ArrayItem put(int index, GroundedValue newValue)
index
- the position of the member to replace (zero-based)newValue
- the replacement valuejava.lang.IndexOutOfBoundsException
- if the index is out of rangepublic ArrayItem 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 rangepublic int arrayLength()
Note: the method always returns 1, because an array is an item
public boolean isEmpty()
public java.lang.Iterable<GroundedValue> members()
public 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 rangepublic ArrayItem concat(ArrayItem other)
other
- the second arraypublic ArrayItem remove(int index)
index
- the position of the member to be removed (zero-based)java.lang.IndexOutOfBoundsException
- if index is out of rangeCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.