MCPcopy Create free account
hub / github.com/MenoData/Time4J / findMax

Method findMax

base/src/main/java/net/time4j/range/IntervalTree.java:590–625  ·  view source on GitHub ↗
(
        Node<T, I> n,
        TimeLine<T> timeLine
    )

Source from the content-addressed store, hash-verified

588 }
589
590 private static <T, I extends ChronoInterval<T>> Boundary<T> findMax(
591 Node<T, I> n,
592 TimeLine<T> timeLine
593 ) {
594
595 if ((n.left == null) && (n.right == null)) {
596 return n.max;
597 } else if (n.left == null) {
598 if (compareAtEnd(n.right.max, n.max, timeLine) > 0) {
599 return n.right.max;
600 } else {
601 return n.max;
602 }
603 } else if (n.right == null) {
604 if (compareAtEnd(n.left.max, n.max, timeLine) > 0) {
605 return n.left.max;
606 } else {
607 return n.max;
608 }
609 }
610
611 Boundary<T> maximized;
612
613 if (compareAtEnd(n.left.max, n.right.max, timeLine) < 0) {
614 maximized = n.right.max;
615 } else {
616 maximized = n.left.max;
617 }
618
619 if (compareAtEnd(n.max, maximized, timeLine) > 0) {
620 maximized = n.max;
621 }
622
623 return maximized;
624
625 }
626
627 private static <T> int compareAtStart(
628 Boundary<T> b1,

Callers 3

insertMethod · 0.95
leftRotateMethod · 0.95
rightRotateMethod · 0.95

Calls 1

compareAtEndMethod · 0.95

Tested by

no test coverage detected