@Test public void addWeightsOfRightLeaningParentNodesChainedRight() throws Exception { Node<InvariantSpan> right2 = new Node<>(new InvariantSpan(1, 3, documentHash)); Node<InvariantSpan> right = new Node.Builder<InvariantSpan>(1).right(right2).build(); new Node.Builder<InvariantSpan>(1).right(right).build(); assertEquals(2, RopeUtils.addWeightsOfRightLeaningParentNodes(right2)); }
public static <T extends StreamElement> long addWeightsOfRightLeaningParentNodes(Node<T> child) { if (child == null) { throw new IllegalStateException("child node can't be null"); } if (child.parent == null) { return 0; } return (child.isRightNode() ? child.parent.weight : 0) + addWeightsOfRightLeaningParentNodes(child.parent); }
RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningParentNodes(Node<T> child) { if (child == null) { throw new IllegalStateException("child node can't be null"); } if (child.parent == null) { return 0; } return (child.isRightNode() ? child.parent.weight : 0) + addWeightsOfRightLeaningParentNodes(child.parent); } }
RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningParentNodes(Node<T> child) { if (child == null) { throw new IllegalStateException("child node can't be null"); } if (child.parent == null) { return 0; } return (child.isRightNode() ? child.parent.weight : 0) + addWeightsOfRightLeaningParentNodes(child.parent); }  }
RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningParentNodes(Node<T> child) { if (child == null) { throw new IllegalStateException("child node can't be null"); } if (child.parent == null) { return 0; } return (child.isRightNode() ? child.parent.weight : 0) + addWeightsOfRightLeaningParentNodes(child.parent); }  static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeightsOfRightLeaningParentNodes(Node<T> child); static void adjustWeightOfLeftLeaningParents(Node<T> startNode, long weight); static long characterCount(Node<T> x); static void collectLeafNodes(Node<T> x, Queue<Node<T>> queue); static Node<T> concat(List<Node<T>> orphans); static Node<T> concat(Node<T> left, Node<T> right); static void cutLeftNode(Node<T> x, List<Node<T>> orphans); static void cutRightNode(Node<T> x, List<Node<T>> orphans); static Node<T> findRoot(Node<T> child); static Node<T> findSearchNode(Node<T> x, long weight, Node<T> root); static NodeIndex<T> index(long characterPosition, Node<T> x, long disp); static boolean intersects(long start, long end, long start2, long end2); static Node<T> rebalance(Node<T> x); }
RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningParentNodes(Node<T> child) { if (child == null) { throw new IllegalStateException("child node can't be null"); } if (child.parent == null) { return 0; } return (child.isRightNode() ? child.parent.weight : 0) + addWeightsOfRightLeaningParentNodes(child.parent); }  static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeightsOfRightLeaningParentNodes(Node<T> child); static void adjustWeightOfLeftLeaningParents(Node<T> startNode, long weight); static long characterCount(Node<T> x); static void collectLeafNodes(Node<T> x, Queue<Node<T>> queue); static Node<T> concat(List<Node<T>> orphans); static Node<T> concat(Node<T> left, Node<T> right); static void cutLeftNode(Node<T> x, List<Node<T>> orphans); static void cutRightNode(Node<T> x, List<Node<T>> orphans); static Node<T> findRoot(Node<T> child); static Node<T> findSearchNode(Node<T> x, long weight, Node<T> root); static NodeIndex<T> index(long characterPosition, Node<T> x, long disp); static boolean intersects(long start, long end, long start2, long end2); static Node<T> rebalance(Node<T> x);  }