|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.saxonica.functions.map.ImmutableMap
public class ImmutableMap
An immutable map. The put() operation which adds or clears an entry has the effect of creating a new map that is conceptually a modified copy of the old map; in fact the implementation is designed to share storage as far as possible.
| Field Summary | |
|---|---|
static SequenceType |
SINGLE_MAP_TYPE
|
| Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
|---|
EMPTY_VALUE_ARRAY |
| Constructor Summary | |
|---|---|
ImmutableMap()
Create an empty map |
|
ImmutableMap(MapItem map,
StringCollator collation,
XPathContext context)
Create an ImmutableMap whose entries are copies of the entries in an existing MapItem, and whose collation is as supplied |
|
| Method Summary | |
|---|---|
ImmutableMap |
copyPut(AtomicValue key,
ValueRepresentation<? extends Item> value,
XPathContext context)
Create a new map containing the existing entries in the map plus an additional entry, without modifying the original |
FunctionItem |
curry(ValueRepresentation<? extends Item>[] value)
Curry a function by binding one or more (but not all) of its arguments |
boolean |
deepEquals(FunctionItem other,
XPathContext context,
GenericAtomicComparer comparer,
int flags)
Test whether this FunctionItem is deep-equal to another function item, under the rules of the deep-equal function |
ValueRepresentation<? extends Item> |
get(AtomicValue key,
XPathContext context)
Get an entry from the Map |
int |
getArity()
Get the arity of the function |
StringCollator |
getCollation()
Get the collation used for the map |
String |
getCollationName()
Get the name of the collation of the map |
FunctionItemType |
getFunctionItemType(TypeHierarchy th)
Get the item type of this item as a function item |
StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous |
AtomicType |
getKeyType(TypeHierarchy th)
Get the lowest common item type of the keys in the map |
com.saxonica.functions.map.KeyValuePair |
getKeyValuePair(AtomicValue key,
XPathContext context)
Get an entry from the Map |
int |
getLength()
Get the size of the value (the number of items) |
String |
getStringValue()
Get the value of the item as a string. |
CharSequence |
getStringValueCS()
Get the string value of the item as a CharSequence. |
SequenceIterator<AtomicValue> |
getTypedValue()
Get the typed value of the item. |
SequenceType |
getValueType(TypeHierarchy th)
Get the lowest common sequence type of all the values in the map |
void |
inSituPut(AtomicValue key,
ValueRepresentation<? extends Item> value,
XPathContext context)
Add a new entry to this map, modifying the original in place |
SequenceIterator<? extends Item> |
invoke(SequenceIterator<? extends Item>[] args,
XPathContext context)
Invoke the function |
boolean |
isEmpty()
Ask whether the map is empty |
MapItem |
itemAt(int n)
Get the n'th item in the value, counting from 0 |
UnfailingIterator<AtomicValue> |
keys()
Get the set of all key values in the map |
MapItem |
remove(AtomicValue key,
XPathContext context)
Remove an entry from the map |
void |
setCollation(String name,
StringCollator collation)
Set the collation to be used for the map |
int |
size()
Get the size of the map |
GroundedValue<MapItem> |
subsequence(int start,
int length)
Get a subsequence of the value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final SequenceType SINGLE_MAP_TYPE
| Constructor Detail |
|---|
public ImmutableMap()
public ImmutableMap(MapItem map,
StringCollator collation,
XPathContext context)
throws XPathException
map - the existing map to be copiedcollation - the collationcontext - the XPath dynamic context
XPathException - if a dynamic error occurs| Method Detail |
|---|
public int getLength()
getLength in interface GroundedValue<MapItem>
public void setCollation(String name,
StringCollator collation)
name - the name of the collation to be usedcollation - the corresponding collation objectpublic StringCollator getCollation()
getCollation in interface MapItempublic String getCollationName()
getCollationName in interface MapItempublic int size()
size in interface MapItempublic boolean isEmpty()
isEmpty in interface MapItempublic AtomicType getKeyType(TypeHierarchy th)
getKeyType in interface MapItemth - the type hierarchy
public SequenceType getValueType(TypeHierarchy th)
getValueType in interface MapItemth - the type hierarchy
public ImmutableMap copyPut(AtomicValue key,
ValueRepresentation<? extends Item> value,
XPathContext context)
throws XPathException
key - the key of the new entryvalue - the value associated with the new entrycontext - the XPath dynamic context
XPathException - if a dynamic error occurs
public void inSituPut(AtomicValue key,
ValueRepresentation<? extends Item> value,
XPathContext context)
throws XPathException
key - the key of the new entryvalue - the value associated with the new entrycontext - the XPath dynamic context
XPathException - if a dynamic error occurs
public MapItem remove(AtomicValue key,
XPathContext context)
throws XPathException
remove in interface MapItemkey - the key of the entry to be removedcontext - the XPath dynamic context
XPathException - if a dynamic error occurs
public ValueRepresentation<? extends Item> get(AtomicValue key,
XPathContext context)
throws XPathException
get in interface MapItemkey - the value of the keycontext - the XPath dynamic evaluation context
XPathException - if a dynamic error occurs
public com.saxonica.functions.map.KeyValuePair getKeyValuePair(AtomicValue key,
XPathContext context)
throws XPathException
key - the value of the keycontext - the XPath dynamic evaluation context
XPathException - if a dynamic error occurspublic UnfailingIterator<AtomicValue> keys()
keys in interface MapItempublic FunctionItemType getFunctionItemType(TypeHierarchy th)
getFunctionItemType in interface FunctionItem<MapItem>th - the type heirarchy cache
public StructuredQName getFunctionName()
getFunctionName in interface FunctionItem<MapItem>public int getArity()
getArity in interface FunctionItem<MapItem>
public SequenceIterator<? extends Item> invoke(SequenceIterator<? extends Item>[] args,
XPathContext context)
throws XPathException
invoke in interface FunctionItem<MapItem>args - the actual arguments to be suppliedcontext - the XPath dynamic evaluation context
XPathException
public FunctionItem curry(ValueRepresentation<? extends Item>[] value)
throws XPathException
curry in interface FunctionItem<MapItem>value - the values to which the arguments are to be bound
XPathException - if any dynamic error occurspublic String getStringValue()
getStringValueCS() should
be used. If the caller requires a string, this method is preferred.
getStringValue in interface Item<MapItem>getStringValue in interface ValueRepresentation<MapItem>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 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 Item<MapItem>getStringValueCS in interface ValueRepresentation<MapItem>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 SequenceIterator<AtomicValue> getTypedValue()
throws XPathException
getTypedValue in interface Item<MapItem>XPathException - where no typed value is available, for example in the case of
an element with complex content
public boolean deepEquals(FunctionItem other,
XPathContext context,
GenericAtomicComparer comparer,
int flags)
throws XPathException
deepEquals in interface FunctionItem<MapItem>other - the other function itemcontext - the dynamic evaluation contextcomparer - the object to perform the comparisonflags - options for how the comparison is performed
XPathException - if the comparison cannot be performedpublic MapItem itemAt(int n)
GroundedValue
itemAt in interface GroundedValue<MapItem>n - the index of the required item, with 0 representing the first item in the sequence
public GroundedValue<MapItem> subsequence(int start,
int length)
GroundedValue
subsequence in interface GroundedValue<MapItem>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 sequence
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||