private Add ( Node t, object key, object val, clojure.lang.Box found ) : Node | ||
t | Node | |
key | object | |
val | object | |
found | clojure.lang.Box | |
Результат | Node |
Node Add(Node t, object key, object val, Box found)
{
if (t == null)
return val == null
? new Red(key)
: new RedVal(key, val);
int c = DoCompare(key, t.Key);
if (c == 0)
{
found.Val = t;
return null;
}
Node ins = c < 0 ? Add(t.Left, key, val, found) : Add(t.Right, key, val, found);
if (ins == null)
return null;
return c < 0
? t.AddLeft(ins)
: t.AddRight(ins);
}