void addStub(int childId, int parentId, short elementTypeIndex) {
    assert myTempState != null;

    myStubData.add(elementTypeIndex); myStubData.add(0); myStubData.add(0);

    if (childId == 0) return;

    int childrenCount = getChildrenCount(parentId);
    int childrenStart = myTempState.ensureCapacityForNextChild(childId, parentId, childrenCount);

    ChildrenStorage storage = getChildrenStorage(childrenStart);
    if (storage == ChildrenStorage.inJoinedList) {
      addToJoinedChildren(childrenStart + childrenCount, childId);
    }
    else if (storage == ChildrenStorage.inTempMap) {
      tempMap().get(parentId).add(childId);
    }

    myStubData.set(childrenCountIndex(parentId), childrenCount + 1);
  }
void addStub(int childId, int parentId, short elementTypeIndex)