/** Replace this.parent by replacement. */ void replaceParent(DepChain replacement) { if (parent instanceof WeakBinderRef) { VisageObject obj = ((WeakBinderRef) parent).get(); // FIXME : do we need this null check here? if (obj != null) { obj.setDepChain$internal$(replacement); } } else { DepChain pchain = (DepChain) parent; if (pchain.child0 == this) pchain.child0 = replacement; if (pchain.child1 == this) pchain.child1 = replacement; } }
/** Replace parent.selector by dep, returning old value. */ private static DepChain replace(Object parent, int selector, DepChain dep) { DepChain old = null; if (selector == -1) { WeakBinderRef wref = (WeakBinderRef) parent; VisageObject visageObj = wref.get(); // FIXME : do we need this null check here? if (visageObj != null) { old = visageObj.getDepChain$internal$(); visageObj.setDepChain$internal$(dep); } } else { DepChain pchain = (DepChain) parent; if (selector == 0) { old = pchain.child0; pchain.child0 = dep; } else { old = pchain.child1; pchain.child1 = dep; } } return old; }