segStore on disk: Fix boundaries for child lookup
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Tue, 18 Apr 2017 18:28:22 +0000 (14:28 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Fri, 28 Apr 2017 01:35:39 +0000 (21:35 -0400)
Change-Id: I098c412edc8050dcabf9ec01d2b50208fbb89acb
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/95206
Reviewed-by: Hudson CI
Reviewed-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Tested-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/internal/segmentstore/core/segmentHistoryTree/SegmentTreeNode.java

index bd58fcdd04f680f6104b360fd5cf62d9facd5335..8d01d72702bba073ea6a8438abab3bc9f7eacd94 100644 (file)
@@ -295,8 +295,8 @@ public class SegmentTreeNode<E extends ISegment2> extends OverlappingNode<E> {
         }
 
         /**
-         * Get a segment from a comparator that correspond whose field wrt to
-         * the comparator is the smallest value of the child node.
+         * Get the segment for a child node with the least value for the field
+         * corresponding to the comparator's field.
          *
          * @param index
          *            The index of the child node
@@ -315,17 +315,9 @@ public class SegmentTreeNode<E extends ISegment2> extends OverlappingNode<E> {
             } else if (order.equals(SegmentComparators.INTERVAL_END_COMPARATOR.reversed())) {
                 return new BasicSegment2(getChildEnd(index), getChildEnd(index));
             } else if (order.equals(SegmentComparators.INTERVAL_LENGTH_COMPARATOR)) {
-                /*
-                 * Do a math.max to prevent overflow, especially in case of
-                 * empty nodes where min length can be Long.MAX_VALUE
-                 */
-                return new BasicSegment2(getChildStart(index), getChildStart(index) + fMinLength[index]);
+                return new BasicSegment2(0, fMinLength[index]);
             } else if (order.equals(SegmentComparators.INTERVAL_LENGTH_COMPARATOR.reversed())) {
-                /*
-                 * Do a math.max to prevent overflow, though it should not
-                 * happen in this case
-                 */
-                return new BasicSegment2(getChildStart(index), Math.max(getChildStart(index) + fMaxLength[index], getChildStart(index)));
+                return new BasicSegment2(0, fMaxLength[index]);
             }
             // TODO: Don't know what to do with other comparators yet
             return new BasicSegment2(getChild(index), getChild(index));
This page took 0.026868 seconds and 5 git commands to generate.