You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
protecteddefsetValue[V1>:V]( node: N, index: Int, v: V1 )
241
241
242
242
243
+
/**
244
+
* Returns the leaf position of the key that is least greater than or equal to `key`.
245
+
**/
246
+
protecteddefleastGTE( key: K ) =
247
+
lookupGTE( key ) match {
248
+
case (_, leaf, index) => (leaf, index)
249
+
}
250
+
251
+
/**
252
+
* Returns the leaf position of the key that is least greater than `key`.
253
+
**/
254
+
protecteddefleastGT( key: K ) =
255
+
lookupGTE( key ) match {
256
+
case (true, leaf, index) => nextPosition( leaf, index )
257
+
case (false, leaf, index) => (leaf, index)
258
+
}
259
+
260
+
/**
261
+
* Returns the key/value pair whose key is least greater than or equal to `key`.
262
+
*/
263
+
defleastGreaterThanOrEqual( key: K ) = optionalKeyValue( leastGTE(key) )
264
+
265
+
/**
266
+
* Returns the key/value pair whose key is least greater than `key`.
267
+
*/
268
+
defleastGreaterThan( key: K ) = optionalKeyValue( leastGT(key) )
269
+
243
270
/**
244
271
* Returns a bounded iterator over a range of key/value pairs in the tree in ascending sorted key order. The range of key/value pairs in the iterator is specified by `bounds`. `bounds` must contain one or two pairs where the first element in the pair is a symbol corresponding to the type of bound (i.e. '<, '<=, '>, '>=) and the second element is a key value.
* Returns a bounded iterator over a range of key positions (node/index pairs) in the tree in ascending sorted key order. The `bounds` parameter is the same as for [[boundedIterator]].
* @return `Some( (key, value) )` where `key` is the minimum key and `value` is it's associated value if the tree is non-empty, or `None` if the tree is empty.
422
456
*/
423
-
defmin=
424
-
if (isEmpty)
425
-
None
426
-
else
427
-
Some( (getKey(first, 0), getValue(first, 0)) )
457
+
defmin= optionalKeyValue( first, 0 )
428
458
429
459
/**
430
460
* Returns the minimum key.
431
461
*/
432
-
defminKey=
433
-
if (isEmpty)
434
-
None
435
-
else
436
-
Some( getKey(first, 0) )
462
+
defminKey= optionalKey( first, 0 )
437
463
438
464
/**
439
465
* Inserts `key` with associated `value` into the tree. If `key` exists, then it's new associated value will be `value`.
* Returns the key/value pair at `index` in `leaf` as well as the leaf node and index where the next key (in sorted order) is located. This method assumes that `index` is the index of an existing key within `node`.
564
-
*
565
-
* @return a pair where the first element is the key/value pair, and the second element is a pair containing the node containing the next key in sorted order (or `null` if there is no next key), and the index of the next key (or 0 if there is no next key)
566
-
*/
567
-
protecteddefnextKeyValue( leaf: N, index: Int ) = (getKeyValue( leaf, index), nextPosition( leaf, index ))
568
588
569
589
/**
570
590
* Returns the key/value pair at `index` within `leaf`.
0 commit comments