MCPcopy Create free account
hub / github.com/microsoft/SandDance / moveSubtree

Function moveSubtree

docs/app/js/sanddance-app.js:138226–138233  ·  view source on GitHub ↗
(wm, wp, shift)

Source from the content-addressed store, hash-verified

138224// Shifts the current subtree rooted at w+. This is done by increasing
138225// prelim(w+) and mod(w+) by shift.
138226function moveSubtree(wm, wp, shift) {
138227 var change = shift / (wp.i - wm.i);
138228 wp.c -= change;
138229 wp.s += shift;
138230 wm.c += change;
138231 wp.z += shift;
138232 wp.m += shift;
138233}
138234// All other shifts, applied to the smaller subtrees between w- and w+, are
138235// performed by this function. To prepare the shifts, we have to adjust
138236// change(w+), shift(w+), and change(w-).

Callers 1

apportionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected