public class RangeKey extends java.lang.Object implements MapItem
At present range keys are only available for string-valued keys using the Unicode codepoint collating sequence.
Constructor and Description |
---|
RangeKey(java.lang.String min,
java.lang.String max,
java.util.TreeMap<AtomicMatchKey,java.util.List<NodeInfo>> index) |
Modifier and Type | Method and Description |
---|---|
MapItem |
addEntry(AtomicValue key,
Sequence value)
Create a new map containing the existing entries in the map plus an additional entry,
without modifying the original.
|
AtomicSequence |
atomize()
Atomize the item.
|
Sequence |
call(XPathContext context,
Sequence[] args)
Invoke the function
|
boolean |
conforms(AtomicType keyType,
SequenceType valueType,
TypeHierarchy th)
Ask whether the map conforms to a given map type
|
boolean |
deepEquals(Function other,
XPathContext context,
AtomicComparer comparer,
int flags)
Test whether this FunctionItem is deep-equal to another function item,
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(AtomicValue key)
Get an entry from the Map
|
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.
|
MapType |
getFunctionItemType()
Get the item type of the function item
|
StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous
|
MapType |
getItemType(TypeHierarchy th)
Get the type of the map.
|
UType |
getKeyUType()
Get the lowest common item type of the keys in the map
|
int |
getLength()
Get the size of the value (the number of items)
|
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 string value of the item as a CharSequence.
|
Function |
head()
Get the first item in the sequence.
|
boolean |
isArray()
Ask whether this function item is an array
|
boolean |
isEmpty()
Ask whether the map 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
|
Function |
itemAt(int n)
Get the n'th item in the value, counting from 0
|
UnfailingIterator |
iterate()
Get an iterator over all the items in the sequence
|
java.util.Iterator<KeyValuePair> |
iterator()
Get the set of all key-value pairs in the map
|
AtomicIterator |
keys()
Get the set of all key values in the map.
|
XPathContext |
makeNewContext(XPathContext callingContext)
Prepare an XPathContext object for evaluating the function
|
GroundedValue |
reduce()
Reduce the sequence to its simplest form.
|
MapItem |
remove(AtomicValue key)
Remove an entry from the map
|
int |
size()
Get the size of the map
|
GroundedValue |
subsequence(int start,
int length)
Get a subsequence of the value
|
public RangeKey(java.lang.String min, java.lang.String max, java.util.TreeMap<AtomicMatchKey,java.util.List<NodeInfo>> index) throws XPathException
XPathException
public boolean isArray()
public boolean isMap()
public AnnotationList getAnnotations()
getAnnotations
in interface Function
public OperandRole[] getOperandRoles()
getOperandRoles
in interface Function
public AtomicSequence atomize() throws XPathException
atomize
in interface Item
XPathException
- if atomization is not allowed
for this kind of itempublic Sequence get(AtomicValue key)
public int size()
public boolean isEmpty()
public AtomicIterator keys()
public java.util.Iterator<KeyValuePair> iterator()
iterator
in interface java.lang.Iterable<KeyValuePair>
iterator
in interface MapItem
public MapItem remove(AtomicValue key)
public UType getKeyUType()
getKeyUType
in interface MapItem
public MapItem addEntry(AtomicValue key, Sequence value)
public boolean conforms(AtomicType keyType, SequenceType valueType, TypeHierarchy th)
public MapType getItemType(TypeHierarchy th)
getItemType
in interface MapItem
th
- the type hierarchy (not used)public MapType 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 suppliedXPathException
- 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 Function itemAt(int n)
itemAt
in interface GroundedValue
n
- the index of the required item, with 0 representing the first item in the sequencepublic GroundedValue subsequence(int start, int length)
subsequence
in interface GroundedValue
start
- the index of the first item to be included in the result, counting from zero.
A negative value is taken as zero. If the value is beyond the end of the sequence, an empty
sequence is returnedlength
- the number of items to be included in the result. Specify Integer.MAX_VALUE to
get the subsequence up to the end of the base sequence. If the value is negative, an empty sequence
is returned. If the value goes off the end of the sequence, the result returns items up to the end
of the sequencepublic int getLength()
getLength
in interface GroundedValue
public 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 GroundedValue reduce()
reduce
in interface GroundedValue
public java.lang.String getStringValue()
getStringValueCS()
should
be used. If the caller requires a string, this method is preferred.getStringValue
in interface GroundedValue
getStringValue
in interface Item
java.lang.UnsupportedOperationException
- if the item is a function item (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()
X.getStringValueCS().toString()
returns a string that is equal to
X.getStringValue()
.
Note that two CharSequence values of different types should not be compared using equals(), and
for the same reason they should not be used as a key in a hash table.
If the calling code can handle any CharSequence, this method should
be used. If the caller requires a string, the getStringValue()
method is preferred.getStringValueCS
in interface GroundedValue
getStringValueCS
in interface Item
java.lang.UnsupportedOperationException
- if the item is a function item (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValue()
public Function head()
public UnfailingIterator iterate()
public void export(ExpressionPresenter out) throws XPathException
export
in interface Function
XPathException
public boolean isTrustedResultType()
Function
isTrustedResultType
in interface Function
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.