public class SimpleArrayItem extends AbstractItem 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<Sequence> members)
Construct an array whose members are arbitrary sequences
|
Modifier and Type | Method and Description |
---|---|
int |
arrayLength()
Get the size of the array
|
AtomicSequence |
atomize()
Atomize the item.
|
Sequence |
call(XPathContext context,
Sequence[] args)
Invoke the array in its role as a function
|
ArrayItem |
concat(ArrayItem other)
Concatenate this array with another
|
boolean |
deepEquals(Function other,
XPathContext context,
AtomicComparer comparer,
int flags)
Test whether this array is deep-equal to another array,
under the rules of the deep-equal function
|
boolean |
effectiveBooleanValue()
Get the effective boolean value of this sequence
|
void |
export(ExpressionPresenter out)
Output information about this function item to the diagnostic explain() output
|
Sequence |
get(int index)
Get a member of the array
|
AnnotationList |
getAnnotations()
Get the function annotations (as defined in XQuery).
|
int |
getArity()
Get the arity of the function
|
java.lang.String |
getDescription()
Get a description of this function for use in error messages.
|
FunctionItemType |
getFunctionItemType()
Get the item type of the function item
|
StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous
|
java.util.List<Sequence> |
getMembers()
Get a list of the members of the array
|
SequenceType |
getMemberType(TypeHierarchy th)
Get the lowest common item type of the members of the array
|
OperandRole[] |
getOperandRoles()
Get the roles of the arguments, for the purposes of streaming
|
java.lang.String |
getStringValue()
Get the value of the item as a string.
|
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
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
|
boolean |
isTrustedResultType()
Check that result type is of the trusted system functions to return a result of the correct type
|
java.util.Iterator<Sequence> |
iterator()
Get the list of all members of the array
|
void |
makeGrounded()
Ensure that all the members are grounded.
|
XPathContext |
makeNewContext(XPathContext callingContext)
Prepare an XPathContext object for evaluating the function
|
static SimpleArrayItem |
makeSimpleArrayItem(SequenceIterator input)
Construct an array whose members are single items
|
ArrayItem |
put(int index,
Sequence 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
|
java.lang.String |
toString()
Output a string representation of the array, suitable for diagnostics
|
getLength, head, isStreamed, itemAt, iterate, reduce, subsequence
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLength, head, itemAt, reduce, subsequence
public static final SimpleArrayItem EMPTY_ARRAY
public SimpleArrayItem(java.util.List<Sequence> members)
members
- the list of values (in general, each value is a sequence) to form the members of the arraypublic 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
public void makeGrounded() throws XPathException
XPathException
public AtomicSequence atomize() throws XPathException
atomize
in interface Item
XPathException
- if atomization is not allowed for this kind of itempublic boolean isArray()
public boolean isMap()
public AnnotationList getAnnotations()
getAnnotations
in interface Function
public Sequence 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, Sequence 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.util.Iterator<Sequence> iterator()
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 SequenceType getMemberType(TypeHierarchy th)
getMemberType
in interface ArrayItem
public FunctionItemType getFunctionItemType()
getFunctionItemType
in interface Function
public StructuredQName getFunctionName()
getFunctionName
in interface Function
public java.lang.String getDescription()
getDescription
in interface Function
public int getArity()
public XPathContext makeNewContext(XPathContext callingContext)
makeNewContext
in interface Function
callingContext
- the XPathContext of the function calling expressionpublic Sequence call(XPathContext context, Sequence[] args) throws XPathException
call
in interface Callable
call
in interface Function
context
- the XPath dynamic evaluation contextargs
- the actual arguments to be supplied (a single integer)XPathException
- if a dynamic error occurs within the functionpublic boolean deepEquals(Function other, XPathContext context, AtomicComparer comparer, int flags) throws XPathException
deepEquals
in interface Function
other
- the other function itemcontext
- the dynamic evaluation contextcomparer
- the object to perform the comparisonflags
- options for how the comparison is performedXPathException
- if the comparison cannot be performedpublic boolean effectiveBooleanValue() throws XPathException
effectiveBooleanValue
in interface GroundedValue
XPathException
- if the sequence has no effective boolean value (for example a sequence of two integers)public java.lang.String getStringValue()
getStringValue
in interface GroundedValue
getStringValue
in interface Item
java.lang.UnsupportedOperationException
- if the item is an array (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValueCS()
public java.lang.CharSequence getStringValueCS()
getStringValueCS
in interface GroundedValue
getStringValueCS
in interface Item
java.lang.UnsupportedOperationException
- if the item is an array (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValueCS()
public void export(ExpressionPresenter out) throws XPathException
export
in interface Function
XPathException
public boolean isTrustedResultType()
Function
isTrustedResultType
in interface Function
public java.util.List<Sequence> getMembers()
getMembers
in interface ArrayItem
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.