1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
// **********************************************************************
//
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package Freeze;
/**
* Parent interface for Freeze maps.
**/
public interface NavigableMap<K, V> extends java.util.SortedMap<K, V>
{
/**
* Alternative to <code>java.util.SortedMap.remove</code>. This version
* is more efficient because it does not decode and return the
* old value.
*
* @param key The key of the entry to remove.
* @return <code>true</code> if an entry for <code>key</code> was removed;
* <code>false</code>, otherwise.
**/
boolean fastRemove(K key);
/**
* Returns The entry with the least key.
*
* @return The entry with the least key, or <code>null</code> if the map is empty.
**/
java.util.Map.Entry<K, V> firstEntry();
/**
* Returns The entry with the greatest key.
*
* @return The entry with the greatest key, or <code>null</code> if the map is empty.
**/
java.util.Map.Entry<K, V> lastEntry();
/**
* Returns the entry with the least key greater than or equal to the given key.
*
* @param key The key.
* @return The entry with the least key greater than or equal to the given key,
* or <code>null</code> if there is no such entry.
**/
java.util.Map.Entry<K, V> ceilingEntry(K key);
/**
* Returns the entry with the greatest key less than or equal to the given key.
*
* @param key The key.
* @return The entry with the greatest key less than or equal to the given key,
* or <code>null</code> if there is no such entry.
**/
java.util.Map.Entry<K, V> floorEntry(K key);
/**
* Returns the entry with the least key strictly greater than the given key.
*
* @param key The key.
* @return The entry with the least key strictly greater than the given key,
* or <code>null</code> if there is no such entry.
**/
java.util.Map.Entry<K, V> higherEntry(K key);
/**
* Returns the entry with the greatest key strictly less than the given key.
*
* @param key The key.
* @return The entry with the greatest key strictly less than the given key,
* or <code>null</code> if there is no such entry.
**/
java.util.Map.Entry<K, V> lowerEntry(K key);
/**
* Returns the least key greater than or equal to the given key.
*
* @param key The key.
* @return The least key greater than or equal to the given key,
* or <code>null</code> if there is no such key.
**/
K ceilingKey(K key);
/**
* Returns the greatest key less than or equal to the given key.
*
* @param key The key.
* @return The greatest key less than or equal to the given key,
* or <code>null</code> if there is no such key.
**/
K floorKey(K key);
/**
* Returns the least key strictly greater than the given key.
*
* @return The least key strictly greater than the given key,
* or <code>null</code> if there is no such key.
**/
K higherKey(K key);
/**
* Returns the greatest key strictly less than the given key.
*
* @return The greatest key strictly less than the given key,
* or <code>null</code> if there is no such key.
**/
K lowerKey(K key);
/**
* Returns a reverse order <code>Set</code> view of the keys contained in this map. The set's iterator
* returns the keys in descending order. The set is backed by the map, so changes to the map are reflected
* in the set and vice versa.
* <p>
* Insertions cannot be made via the returned set and must be made on the main map.
* <p>
* <code>remove</code> and <code>fastRemove</code> on the returned set or on an iterator for the returned
* set are supported, but only if this map does not have an index; otherwise, attempts to remove an element
* raise <code>UnsupportedOperationException</code>.
* <p>
* If the map is modified while an iteration over the set is in progress
* (except through the iterator's own <code>remove</code> or <code>fastRemove</code> operation), the results
* of the iteration are undefined.
*
* @return A reverse order set view of the keys in this map.
**/
java.util.Set<K> descendingKeySet();
/**
* Returns a reverse order view of the mappings contained in this map.
* The descending map is backed by this map, so changes to the map are reflected in the descending map
* and vice versa.
*<p>
* Insertions cannot be made via the descending map and must be made on the main map.
* <p>
* <code>remove</code> and <code>fastRemove</code> on the descending map or on an iterator for the descending
* map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry
* raise <code>UnsupportedOperationException</code>.
* <p>
* If either map is modified while an iteration over either map is
* in progress (except through the iterator's own <code>remove</code> or <code>fastRemove</code>operation),
* the results of the iteration are undefined.
*
* @return a Reverse order view of this map.
**/
NavigableMap<K, V> descendingMap();
/**
* Returns a view of the portion of this map whose keys are strictly less than <code>toKey</code>, or less than
* or equal to <code>toKey</code> if <code>inclusive</code> is true.
* The returned map is backed by this map, so changes to this map are reflected in the returned map
* and vice versa.
*<p>
* Insertions cannot be made via the returned map and must be made on the main map.
* <p>
* <code>remove</code> and <code>fastRemove</code> on the returned map or on an iterator for the returned
* map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry
* raise <code>UnsupportedOperationException</code>.
* <p>
* The returned map throws an <code>IllegalArgumentException</code> on an attempt to insert a key
* outside its range.
*
* @param toKey High endpoint of the keys in the returned map.
* @param inclusive If <code>true</code>, the endpoint is included in the returned map; otherwise, the endpoint
* is excluded.
* @return A view of the portion of this map whose keys are strictly less than <code>toKey</code>, or
* less than or equal to <code>toKey</code> if <code>inclusive</code> is true.
**/
NavigableMap<K, V> headMap(K toKey, boolean inclusive);
/**
* Returns a view of the portion of this map whose keys are strictly greater than <code>fromKey</code>, or greater
* than or equal to <code>fromKey</code> if <code>inclusive</code> is true.
*<p>
* Insertions cannot be made via the returned map and must be made on the main map.
* <p>
* <code>remove</code> and <code>fastRemove</code> on the returned map or on an iterator for the returned
* map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry
* raise <code>UnsupportedOperationException</code>.
* <p>
* The returned map throws an <code>IllegalArgumentException</code> on an attempt to insert a key
* outside its range.
*
* @param fromKey Low endpoint of the keys in the returned map.
* @param inclusive If <code>true</code>, the endpoint is included in the returned map; otherwise, the endpoint
* is excluded.
* @return A view of the portion of this map whose keys are strictly greater than <code>fromKey</code>, or
* greater than or equal to <code>fromKey</code> if <code>inclusive</code> is true.
**/
NavigableMap<K, V> tailMap(K fromKey, boolean inclusive);
/**
* Returns a view of the portion of this map whose keys range from <code>fromKey</code> to <code>toKey</code>.
* If <code>fromKey</code> and <code>toKey</code> are equal, the returned map is empty unless
* <code>fromInclusive</code> and <code>toInclusive</code> are both <code>true</code>.
*<p>
* Insertions cannot be made via the returned map and must be made on the main map.
* <p>
* <code>remove</code> and <code>fastRemove</code> on the returned map or on an iterator for the returned
* map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry
* raise <code>UnsupportedOperationException</code>.
* <p>
* The returned map throws an <code>IllegalArgumentException</code> on an attempt to insert a key
* outside its range.
*
* @param fromKey Low endpoint of the keys in the returned map.
* @param fromInclusive <code>true</code> if the low endpoint is to be included in the returned view;
* <code>false</code>, otherwise.
* @param toKey High endpoint of the keys in the returned map.
* @param toInclusive <code>true</code> if the high endpoint is to be included in the returned view;
* <code>false</code>, otherwise.
* @return A view of the portion of this map whose keys range from <code>fromKey</code> to <code>toKey</code>.
**/
NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive);
/**
* Removes and returns a key-value mapping associated with the least key in this map,
* or <code>null</code> if the map is empty.
*
* @return The removed first entry, or <code>null</code> if this map is empty.
**/
java.util.Map.Entry<K, V> pollFirstEntry();
/**
* Removes and returns a key-value mapping associated with the greatest key in this map,
* or <code>null</code> if the map is empty.
*
* @return The removed last entry, or <code>null</code> if this map is empty.
**/
java.util.Map.Entry<K, V> pollLastEntry();
}
|