public abstract class ArrayItem extends java.lang.Object implements Function
Constructor and Description |
---|
ArrayItem() |
Modifier and Type | Method and Description |
---|---|
abstract int |
arrayLength()
Get the number of members in the array
|
abstract ArrayItem |
concat(ArrayItem other)
Concatenate this array with another
|
abstract GroundedValue |
get(int index)
Get a member of the array
|
Genre |
getGenre()
Get the genre of this item
|
abstract SequenceType |
getMemberType(TypeHierarchy th)
Get the lowest common item type of the members of the array
|
abstract 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
|
abstract java.lang.Iterable<GroundedValue> |
members()
Get the list of all members of the array
|
abstract ArrayItem |
put(int index,
GroundedValue newValue)
Replace a member of the array
|
abstract ArrayItem |
remove(int index)
Remove a member from the array
|
abstract ArrayItem |
removeSeveral(IntSet positions)
Remove zero or more members from the array
|
abstract ArrayItem |
subArray(int start,
int end)
Get a sub-array 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
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deepEquals, export, getAnnotations, getArity, getDescription, getFunctionItemType, getFunctionName, getOperandRoles, isSequenceVariadic, isTrustedResultType, makeNewContext
atomize, getLength, getStringValue, getUnicodeStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize
makeRepeatable
public final boolean isArray()
public final boolean isMap()
public abstract GroundedValue get(int index)
index
- the position of the member to retrieve (zero-based)java.lang.IndexOutOfBoundsException
- if the index is out of rangepublic abstract 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 abstract int arrayLength()
Note: the method always returns 1, because an array is an item
public boolean isEmpty()
public abstract java.lang.Iterable<GroundedValue> members()
public abstract ArrayItem concat(ArrayItem other)
other
- the second arraypublic abstract ArrayItem remove(int index)
index
- the position of the member to be removed (zero-based)java.lang.IndexOutOfBoundsException
- if index is out of rangepublic abstract ArrayItem removeSeveral(IntSet positions)
positions
- the positions of the members to be removed (zero-based).
A value that is out of range is ignored.java.lang.IndexOutOfBoundsException
- if any of the positions is out of rangepublic abstract 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 abstract 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 abstract SequenceType getMemberType(TypeHierarchy th)
th
- the type hierarchypublic java.lang.String toShortString()
toShortString
in interface Function
toShortString
in interface GroundedValue
toShortString
in interface Item
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.