MCPcopy Create free account
hub / github.com/GateNLP/gate-core / getCeilEntry

Method getCeilEntry

src/main/java/gate/util/RBTreeMap.java:362–390  ·  view source on GitHub ↗

Gets the entry corresponding to the specified key; if no such entry exists, returns the entry for the least key greater than the specified key; if no such entry exists (i.e., the greatest key in the Tree is less than the specified key), returns null .

(Object key)

Source from the content-addressed store, hash-verified

360 * than the specified key), returns <tt>null</tt>.
361 */
362 private Entry<K,V> getCeilEntry(Object key) {
363 Entry<K,V> p = root;
364 if (p==null)
365 return null;
366
367 while (true) {
368 int cmp = compare(key, p.key);
369 if (cmp == 0) {
370 return p;
371 } else if (cmp < 0) {
372 if (p.left != null)
373 p = p.left;
374 else
375 return p;
376 } else {
377 if (p.right != null) {
378 p = p.right;
379 } else {
380 Entry<K,V> parent = p.parent;
381 Entry<K,V> ch = p;
382 while (parent != null && ch == parent.right) {
383 ch = parent;
384 parent = parent.parent;
385 }
386 return parent;
387 }
388 }
389 }
390 }
391
392 /**
393 * Returns the entry for the greatest key less than the specified key; if

Callers 4

getClosestMatchMethod · 0.95
getNextOfMethod · 0.95
firstKeyMethod · 0.80
iteratorMethod · 0.80

Calls 1

compareMethod · 0.95

Tested by

no test coverage detected