MCPcopy Index your code
hub / github.com/clojure/clojure / remove

Method remove

src/jvm/clojure/lang/PersistentTreeMap.java:357–381  ·  view source on GitHub ↗
(Node t, Object key, Box found)

Source from the content-addressed store, hash-verified

355}
356
357Node remove(Node t, Object key, Box found){
358 if(t == null)
359 return null; //not found indicator
360 int c = doCompare(key, t.key);
361 if(c == 0)
362 {
363 found.val = t;
364 return append(t.left(), t.right());
365 }
366 Node del = c < 0 ? remove(t.left(), key, found) : remove(t.right(), key, found);
367 if(del == null && found.val == null) //not found below
368 return null;
369 if(c < 0)
370 {
371 if(t.left() instanceof Black)
372 return balanceLeftDel(t.key, t.val(), del, t.right());
373 else
374 return red(t.key, t.val(), del, t.right());
375 }
376 if(t.right() instanceof Black)
377 return balanceRightDel(t.key, t.val(), t.left(), del);
378 return red(t.key, t.val(), t.left(), del);
379// return t.removeLeft(del);
380// return t.removeRight(del);
381}
382
383static Node append(Node left, Node right){
384 if(left == null)

Callers 1

withoutMethod · 0.95

Calls 8

doCompareMethod · 0.95
appendMethod · 0.95
balanceLeftDelMethod · 0.95
redMethod · 0.95
balanceRightDelMethod · 0.95
valMethod · 0.65
leftMethod · 0.45
rightMethod · 0.45

Tested by

no test coverage detected