@Test public void pruneNullLeft() throws Exception { Node<InvariantSpan> right = new Node<>(new InvariantSpan(2, 1, documentHash)); new Node.Builder<InvariantSpan>(0).right(right).build(); List<Node<InvariantSpan>> orphans = Partitioner.pruneIndexNode(right, 1, 0); assertEquals(0, orphans.size()); }
public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = false; } return pruneTree(indexNode.parent.parent, 0, leftPartitionWidth, displacement, indexNode.parent.parent.isRightNode()); } return new ArrayList<>(); } else { return pruneTree(indexNode.parent, 0, leftPartitionWidth, displacement, true); } }
Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = false; } return pruneTree(indexNode.parent.parent, 0, leftPartitionWidth, displacement, indexNode.parent.parent.isRightNode()); } return new ArrayList<>(); } else { return pruneTree(indexNode.parent, 0, leftPartitionWidth, displacement, true); } } }
Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = false; } return pruneTree(indexNode.parent.parent, 0, leftPartitionWidth, displacement, indexNode.parent.parent.isRightNode()); } return new ArrayList<>(); } else { return pruneTree(indexNode.parent, 0, leftPartitionWidth, displacement, true); } }  }
Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = false; } return pruneTree(indexNode.parent.parent, 0, leftPartitionWidth, displacement, indexNode.parent.parent.isRightNode()); } return new ArrayList<>(); } else { return pruneTree(indexNode.parent, 0, leftPartitionWidth, displacement, true); } }  static NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x); static List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth,
			long displacement); }
Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = false; } return pruneTree(indexNode.parent.parent, 0, leftPartitionWidth, displacement, indexNode.parent.parent.isRightNode()); } return new ArrayList<>(); } else { return pruneTree(indexNode.parent, 0, leftPartitionWidth, displacement, true); } }  static NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x); static List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth,
			long displacement);  }