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, subsequenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLength, head, itemAt, reduce, subsequencepublic 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 Functionpublic void makeGrounded()
throws XPathException
XPathExceptionpublic AtomicSequence atomize() throws XPathException
atomize in interface ItemXPathException - if atomization is not allowed for this kind of itempublic boolean isArray()
public boolean isMap()
public AnnotationList getAnnotations()
getAnnotations in interface Functionpublic Sequence get(int index) throws XPathException
get in interface ArrayItemindex - 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 ArrayItemindex - 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 ArrayItempublic boolean isEmpty()
public java.util.Iterator<Sequence> iterator()
public ArrayItem removeSeveral(IntSet positions)
removeSeveral in interface ArrayItempositions - 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 ArrayItempublic FunctionItemType getFunctionItemType()
getFunctionItemType in interface Functionpublic StructuredQName getFunctionName()
getFunctionName in interface Functionpublic java.lang.String getDescription()
getDescription in interface Functionpublic int getArity()
public XPathContext makeNewContext(XPathContext callingContext)
makeNewContext in interface FunctioncallingContext - the XPathContext of the function calling expressionpublic Sequence call(XPathContext context, Sequence[] args) throws XPathException
call in interface Callablecall in interface Functioncontext - 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 Functionother - 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 GroundedValueXPathException - if the sequence has no effective boolean value (for example a sequence of two integers)public java.lang.String getStringValue()
getStringValue in interface GroundedValuegetStringValue in interface Itemjava.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 GroundedValuegetStringValueCS in interface Itemjava.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 FunctionXPathExceptionpublic boolean isTrustedResultType()
FunctionisTrustedResultType in interface Functionpublic java.util.List<Sequence> getMembers()
getMembers in interface ArrayItempublic java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.