void labelIntermediateTrie(final Node node, final LongArrayBitVector path, final OfflineIterable<BitVector, LongArrayBitVector> delimiters, final OfflineIterable<BitVector, LongArrayBitVector> representations, final OfflineIterable<BitVector, LongArrayBitVector> keys, final LongBigList internalNodeSignatures, final long seed, final boolean left) throws IOException { assert (node.left != null) == (node.right != null); final long parentPathLength = Math.max(0, path.length() - 1); if (node.left != null) { path.append(node.path); labelIntermediateTrie(node.left, path.append(0, 1), delimiters, representations, keys, internalNodeSignatures, seed, true); path.removeBoolean((int)(path.length() - 1)); final long h = Hashes.spooky4(path, seed); final long p = (-1L << Fast.mostSignificantBit(parentPathLength ^ path.length()) & path.length()); assert p <= path.length() : p + " > " + path.length(); assert path.length() == 0 || p > parentPathLength : p + " <= " + parentPathLength; keys.add(LongArrayBitVector.copy(path.subVector(0, p))); representations.add(path.copy()); assert Fast.length(path.length()) <= logW; if (DDDEBUG) System.err.println("Entering " + path + " with key (" + p + "," + path.subVector(0, p).hashCode() + ") " + path.subVector(0, p) + ", signature " + (h & signatureMask) + " and length " + (path.length() & logWMask) + "(value: " + ((h & signatureMask) << logW | (path.length() & logWMask)) + ")"); internalNodeSignatures.add((h & signatureMask) << logW | (path.length() & logWMask)); labelIntermediateTrie(node.right, path.append(1, 1), delimiters, representations, keys, internalNodeSignatures, seed, false); path.length(path.length() - node.path.length() - 1); } else { if (left) delimiters.add(LongArrayBitVector.copy(path.subVector(0, path.lastOne() + 1))); else delimiters.add(LongArrayBitVector.copy(path)); } }