in Java/core/src/main/java/com/amazon/randomcutforest/tree/NodeStoreSmall.java [51:97]
public NodeStoreSmall(AbstractNodeStore.Builder builder) {
super(builder);
mass = new byte[capacity];
Arrays.fill(mass, (byte) 0);
if (builder.storeParent) {
parentIndex = new byte[capacity];
Arrays.fill(parentIndex, (byte) capacity);
} else {
parentIndex = null;
}
if (builder.leftIndex == null) {
leftIndex = new char[capacity];
rightIndex = new char[capacity];
cutDimension = new byte[capacity];
Arrays.fill(leftIndex, (char) capacity);
Arrays.fill(rightIndex, (char) capacity);
} else {
checkArgument(builder.leftIndex.length == capacity, " incorrect length");
checkArgument(builder.rightIndex.length == capacity, " incorrect length");
leftIndex = toCharArray(builder.leftIndex);
rightIndex = toCharArray(builder.rightIndex);
cutDimension = toByteArray(builder.cutDimension);
BitSet bits = new BitSet(capacity);
if (builder.root != Null) {
bits.set(builder.root);
}
for (int i = 0; i < leftIndex.length; i++) {
if (isInternal(leftIndex[i])) {
bits.set(leftIndex[i]);
if (parentIndex != null) {
parentIndex[leftIndex[i]] = (byte) i;
}
}
}
for (int i = 0; i < rightIndex.length; i++) {
if (isInternal(rightIndex[i])) {
bits.set(rightIndex[i]);
if (parentIndex != null) {
parentIndex[rightIndex[i]] = (byte) i;
}
}
}
freeNodeManager = new IndexIntervalManager(capacity, capacity, bits);
// need to set up parents using the root
}
}