subtreeSizeOf method

int subtreeSizeOf(
  1. int nid
)

Per-nid count of currently-visible entries in the subtree rooted at nid, including nid itself when it is in the order. O(1) array read. Returns 0 for nids that are not currently in the order and have no visible descendants, or for freed nids whose slot was reset.

Implementation

int subtreeSizeOf(int nid) {
  if (nid < 0 || nid >= _subtreeSizeByNid.length) {
    return 0;
  }
  return _subtreeSizeByNid[nid];
}