datastore: Use time conditions with long
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Tue, 21 Feb 2017 15:39:05 +0000 (10:39 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 2 Mar 2017 20:02:32 +0000 (15:02 -0500)
Using primitive type long instead of a generic Long for range conditions
reduces the need for boxing and unboxing time values.

This change alone reduces the performance impact of the datastore by ~2
in use cases of small size for both single and full queries. Coupled with
the patch with single queries API, it reduces the performance impact of
single queries to < 100%

Change-Id: I63ebb20b2441aff1345b733f1ffc25314e63ffd2
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/91754
Reviewed-by: Hudson CI
Reviewed-by: Loic Prieur-Drevon <loic.prieur.drevon@ericsson.com>
13 files changed:
statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeConditionTest.java [new file with mode: 0644]
statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeConditionTest.java [new file with mode: 0644]
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeCondition.java [new file with mode: 0644]
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeCondition.java [new file with mode: 0644]
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/condition/TimeRangeCondition.java [new file with mode: 0644]
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/AbstractHistoryTree.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/HTNode.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHTNode.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHistoryTree.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicHistoryTree.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/AbstractOverlappingHistoryTree.java
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/OverlappingNode.java

diff --git a/statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeConditionTest.java b/statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeConditionTest.java
new file mode 100644 (file)
index 0000000..ecdc952
--- /dev/null
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.internal.datastore.core.condition;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
+import org.junit.Test;
+
+/**
+ * Test the continuous time range condition
+ *
+ * @author Loïc Prieur-Drevon
+ */
+public class ContinuousTimeRangeConditionTest {
+
+    private static final long LOW = 0;
+    private static final long HIGH = 10;
+    private static final ContinuousTimeRangeCondition CONDITION = new ContinuousTimeRangeCondition(LOW, HIGH);
+
+    /**
+     * Ensure that we cannot build a condition with a bigger low than high bound.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testConstructor() {
+        new ContinuousTimeRangeCondition(HIGH, LOW);
+    }
+
+    /**
+     * Ensure that the minimum and maximum functions return the correct values.
+     */
+    @Test
+    public void testBounds() {
+        long low = CONDITION.min();
+        assertEquals(LOW, low);
+        long high = CONDITION.max();
+        assertEquals(HIGH, high);
+    }
+
+    /**
+     * Test that the right elements are contained in the condition.
+     */
+    @Test
+    public void testPredicate() {
+        assertFalse(CONDITION.test(-5));
+        assertTrue(CONDITION.test(LOW));
+        assertTrue(CONDITION.test(5));
+        assertTrue(CONDITION.test(HIGH));
+        assertFalse(CONDITION.test(15));
+    }
+
+    /**
+     * Test that the right intervals intersect the condition.
+     */
+    @Test
+    public void testIntersects() {
+        assertFalse(CONDITION.intersects(Integer.MIN_VALUE, LOW - 1));
+        assertTrue(CONDITION.intersects(-5, 5));
+        assertTrue(CONDITION.intersects(2, 8));
+        assertTrue(CONDITION.intersects(5, 15));
+        assertFalse(CONDITION.intersects(HIGH + 1, Integer.MAX_VALUE));
+    }
+
+    /**
+     * Test that the returned subcondition has the correct bounds.
+     */
+    @Test
+    public void testSubCondition() {
+        TimeRangeCondition sub = CONDITION.subCondition(-5, 8);
+        assertNotNull(sub);
+        assertEquals(ContinuousTimeRangeCondition.class, sub.getClass());
+        long low = sub.min();
+        long high = sub.max();
+        assertEquals(LOW, low);
+        assertEquals(8, high);
+
+        sub = CONDITION.subCondition(HIGH + 1, HIGH + 10);
+        assertNull(sub);
+        sub = CONDITION.subCondition(LOW - 10, LOW - 1);
+        assertNull(sub);
+    }
+
+}
diff --git a/statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeConditionTest.java b/statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeConditionTest.java
new file mode 100644 (file)
index 0000000..90ec0ee
--- /dev/null
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.internal.datastore.core.condition;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
+import org.junit.Test;
+
+/**
+ * Test the singleton time range condition
+ *
+ * @author Geneviève Bastien
+ */
+public class SingletonTimeRangeConditionTest {
+
+    private static final long VALUE = 5;
+    private static final SingletonTimeRangeCondition CONDITION = new SingletonTimeRangeCondition(VALUE);
+
+    /**
+     * Ensure that the minimum and maximum functions return the correct values.
+     */
+    @Test
+    public void testBounds() {
+        assertEquals(VALUE, (int) CONDITION.min());
+        assertEquals(VALUE, (int) CONDITION.max());
+    }
+
+    /**
+     * Test that the right elements are contained in the condition.
+     */
+    @Test
+    public void testPredicate() {
+        assertFalse(CONDITION.test(-5));
+        assertTrue(CONDITION.test(VALUE));
+        assertFalse(CONDITION.test(15));
+    }
+
+    /**
+     * Test that the right intervals intersect the condition.
+     */
+    @Test
+    public void testIntersects() {
+        assertFalse(CONDITION.intersects(Integer.MIN_VALUE, VALUE - 1));
+        assertTrue(CONDITION.intersects(VALUE - 1, VALUE + 1));
+        assertTrue(CONDITION.intersects(VALUE, VALUE + 1));
+        assertTrue(CONDITION.intersects(VALUE - 1, VALUE));
+        assertFalse(CONDITION.intersects(VALUE + 1, Integer.MAX_VALUE));
+    }
+
+    /**
+     * Test that the returned subcondition has the correct bounds.
+     */
+    @Test
+    public void testSubCondition() {
+        TimeRangeCondition sub = CONDITION.subCondition(VALUE - 1, VALUE + 1);
+        assertNotNull(sub);
+        assertEquals(sub, CONDITION);
+
+        // For a range where no value is include, it should return null
+        sub = CONDITION.subCondition(Long.MIN_VALUE, VALUE - 1);
+        assertNull(sub);
+
+        sub = CONDITION.subCondition(VALUE + 1, VALUE + 2);
+        assertNull(sub);
+    }
+
+}
diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeCondition.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeCondition.java
new file mode 100644 (file)
index 0000000..3cf41c1
--- /dev/null
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.datastore.core.condition;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
+
+/**
+ * Time range condition that will verify if values are within a range limited by
+ * a lower and upper bound.
+ *
+ * @author Geneviève Bastien
+ */
+public class ContinuousTimeRangeCondition implements TimeRangeCondition {
+
+    private final long fLongMin;
+    private final long fLongMax;
+
+    /**
+     * Constructor
+     *
+     * @param low
+     *            Lower bound of the range
+     * @param high
+     *            Upper bound of the range
+     */
+    public ContinuousTimeRangeCondition(long low, long high) {
+        if (high < low) {
+            throw new IllegalArgumentException("Continuous time range condition: lower bound (" + low +") should be <= upper bound (" + high + ')');  //$NON-NLS-1$//$NON-NLS-2$
+        }
+        fLongMin = low;
+        fLongMax = high;
+    }
+
+    @Override
+    public long min() {
+        return fLongMin;
+    }
+
+    @Override
+    public long max() {
+        return fLongMax;
+    }
+
+    @Override
+    public boolean test(long element) {
+        return (element >= fLongMin && element <= fLongMax);
+    }
+
+    @Override
+    public boolean intersects(long low, long high) {
+        return (fLongMin <= high && fLongMax >= low);
+    }
+
+    @Override
+    public @Nullable TimeRangeCondition subCondition(long from, long to) {
+        long low = Math.max(from, fLongMin);
+        long high =  Math.min(fLongMax, to);
+        if (high < low) {
+            return null;
+        }
+        return new ContinuousTimeRangeCondition(low, high);
+    }
+
+}
diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeCondition.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeCondition.java
new file mode 100644 (file)
index 0000000..dd6421b
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.datastore.core.condition;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
+
+/**
+ * A time range condition for a singleton time.
+ *
+ * @author Geneviève Bastien
+ */
+public class SingletonTimeRangeCondition implements TimeRangeCondition {
+
+    private final long fValue;
+
+    /**
+     * Constructor
+     *
+     * @param ts
+     *            The timestamp for this condition
+     */
+    public SingletonTimeRangeCondition(long ts) {
+        fValue = ts;
+    }
+
+    @Override
+    public long min() {
+        return fValue;
+    }
+
+    @Override
+    public long max() {
+        return fValue;
+    }
+
+    @Override
+    public boolean test(long element) {
+        return element == fValue;
+    }
+
+    @Override
+    public boolean intersects(long low, long high) {
+        return low <= fValue && high >= fValue;
+    }
+
+    @Override
+    public @Nullable TimeRangeCondition subCondition(long from, long to) {
+        if (intersects(from, to)) {
+            return this;
+        }
+        return null;
+    }
+
+}
diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/condition/TimeRangeCondition.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/condition/TimeRangeCondition.java
new file mode 100644 (file)
index 0000000..80184b2
--- /dev/null
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.provisional.datastore.core.condition;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.datastore.core.condition.ContinuousTimeRangeCondition;
+import org.eclipse.tracecompass.internal.datastore.core.condition.SingletonTimeRangeCondition;
+
+/**
+ * A range condition specific for time ranges. It allows to work with long
+ * primitive types, which provides much better performances
+ *
+ * @author Geneviève Bastien
+ */
+public interface TimeRangeCondition {
+
+    /**
+     * Get the lower bound of this range
+     *
+     * @return the lowest acceptable value for this condition.
+     */
+    long min();
+
+    /**
+     * Get the upper bound of this range
+     *
+     * @return the highest acceptable value for this condition.
+     */
+    long max();
+
+    /**
+     * Test whether a value is within this specific range boundaries. If the
+     * range is continuous, it will return <code>true</code> if the value is
+     * between the lower and upper bounds. If the range is discrete, it will
+     * return <code>true</code> if the requested element is one of the elements
+     * in the discrete range.
+     *
+     * @param element
+     *            value that we want to test
+     * @return true if element is contained in this condition's set or range
+     */
+    boolean test(long element);
+
+    /**
+     * Determine if the current range intersects a ranged bounded by the values
+     * in parameter
+     *
+     * @param low
+     *            interval's lower bound
+     * @param high
+     *            interval's upper bound
+     * @return true if this element intersects the range's condition or any of
+     *         the set's elements
+     */
+    boolean intersects(long low, long high);
+
+    /**
+     * Reduce the Condition to elements or the range within bounds from and to.
+     * <code>null</code> is returned if the resulting condition is empty.
+     *
+     * @param from
+     *            lower bound for the condition reduction.
+     * @param to
+     *            upper bound for the condition reduction.
+     * @return the reduced condition or <code>null</code> if the reduced
+     *         condition does not contain any element
+     */
+    @Nullable TimeRangeCondition subCondition(long from, long to);
+
+    /**
+     * Get a condition of a single element.
+     *
+     * @param elem The single element
+     * @return The corresponding range condition
+     */
+    static TimeRangeCondition singleton(long elem) {
+        return new SingletonTimeRangeCondition(elem);
+    }
+
+    /**
+     * Get a range condition representing a continuous time range.
+     *
+     * @param bound1
+     *            The first bound
+     * @param bound2
+     *            The second bound. It's fine for bound2 to be > or < than
+     *            bound1.
+     * @return The corresponding range condition
+     */
+    static TimeRangeCondition forContinuousRange(long bound1, long bound2) {
+        if (bound2 < bound1) {
+            throw new IllegalArgumentException("Continuous time range condition: lower bound (" + bound1 +") should be <= upper bound (" + bound2 + ')');  //$NON-NLS-1$//$NON-NLS-2$
+        }
+        return new ContinuousTimeRangeCondition(bound1, bound2);
+    }
+
+}
index 598aa0ed7cdab3902790268cb0b7f79b7a93ebcb..85df36becff52304d9e675b479eb396fa26b913b 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.internal.datastore.core.historytree.HtIo;
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.exceptions.RangeException;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.IHTNode.NodeType;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
@@ -873,7 +873,7 @@ public abstract class AbstractHistoryTree<E extends IHTInterval, N extends HTNod
     }
 
     @Override
-    public Iterable<E> getMatchingIntervals(RangeCondition<Long> timeCondition,
+    public Iterable<E> getMatchingIntervals(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate) {
 
         // TODO Change this to evaluate the nodes lazily
@@ -890,7 +890,7 @@ public abstract class AbstractHistoryTree<E extends IHTInterval, N extends HTNod
             while (!queue.isEmpty()) {
                 int sequenceNumber = queue.pop();
                 HTNode<E> currentNode = readNode(sequenceNumber);
-                RangeCondition<Long> nodeCondition = timeCondition.subCondition(
+                TimeRangeCondition nodeCondition = timeCondition.subCondition(
                         currentNode.getNodeStart(), currentNode.getNodeEnd());
 
                 if (nodeCondition == null) {
@@ -910,7 +910,7 @@ public abstract class AbstractHistoryTree<E extends IHTInterval, N extends HTNod
     }
 
     @Override
-    public @Nullable E getMatchingInterval(RangeCondition<Long> timeCondition,
+    public @Nullable E getMatchingInterval(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate) {
 
         /* Queue a stack of nodes containing nodes intersecting t */
@@ -1014,7 +1014,7 @@ public abstract class AbstractHistoryTree<E extends IHTInterval, N extends HTNod
         Collection<Integer> nextChildren;
         for (long t = parent.getNodeStart(); t < parent.getNodeEnd(); t++) {
             shouldBeInCollection = true;
-            nextChildren = parent.selectNextChildren(RangeCondition.singleton(t));
+            nextChildren = parent.selectNextChildren(TimeRangeCondition.singleton(t));
             if (shouldBeInCollection != nextChildren.contains(childSequence)) {
                 return false;
             }
index 2d6054f9d2cb9710fff58d0117c071fe6e834241..0f214da215dee2c57466531631151e1624d9bcd3 100644 (file)
@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.exceptions.RangeException;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.AbstractHistoryTree.IHTNodeFactory;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
@@ -309,7 +309,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
          * @return Collection of sequence numbers of the child nodes that
          *         intersect t, non-null empty collection if this is a Leaf Node
          */
-        public final Collection<Integer> selectNextChildren(RangeCondition<Long> timeCondition) {
+        public final Collection<Integer> selectNextChildren(TimeRangeCondition timeCondition) {
             fNode.takeReadLock();
             try {
                 return selectNextIndices(timeCondition).stream()
@@ -338,7 +338,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
          * @return Collection of the indices of the child nodes that intersect
          *         the time condition
          */
-        protected Collection<Integer> selectNextIndices(RangeCondition<Long> timeCondition) {
+        protected Collection<Integer> selectNextIndices(TimeRangeCondition timeCondition) {
             /* By default, all children are returned */
             List<Integer> childList = new ArrayList<>();
             for (int i = 0; i < fNbChildren; i++) {
@@ -579,7 +579,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
      * comparator.
      *
      * NOTE: sub-classes who override this may also need to override the
-     * {@link #getStartIndexFor(RangeCondition, Predicate)}.
+     * {@link #getStartIndexFor(TimeRangeCondition, Predicate)}.
      *
      * @return The way intervals are to be sorted in this node
      */
@@ -680,7 +680,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
     }
 
     @Override
-    public Iterable<E> getMatchingIntervals(RangeCondition<Long> timeCondition,
+    public Iterable<E> getMatchingIntervals(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate) {
 
         // TODO Benchmark using/returning streams instead of iterables
@@ -699,7 +699,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
     }
 
     @Override
-    public @Nullable E getMatchingInterval(RangeCondition<Long> timeCondition, Predicate<E> extraPredicate) {
+    public @Nullable E getMatchingInterval(TimeRangeCondition timeCondition, Predicate<E> extraPredicate) {
         if (isOnDisk()) {
             return doGetMatchingInterval(timeCondition, extraPredicate);
         }
@@ -713,7 +713,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
         }
     }
 
-    private Iterable<E> doGetMatchingIntervals(RangeCondition<Long> timeCondition,
+    private Iterable<E> doGetMatchingIntervals(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate) {
         List<E> list = new ArrayList<>();
         for (int i = getStartIndexFor(timeCondition, extraPredicate); i < fIntervals.size(); i++) {
@@ -726,7 +726,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
         return list;
     }
 
-    private @Nullable E doGetMatchingInterval(RangeCondition<Long> timeCondition,
+    private @Nullable E doGetMatchingInterval(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate) {
         for (int i = getStartIndexFor(timeCondition, extraPredicate); i < fIntervals.size(); i++) {
             E curInterval = fIntervals.get(i);
@@ -755,7 +755,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
      * @return The index of the first interval greater than or equal to the
      *         conditions in parameter
      */
-    protected int getStartIndexFor(RangeCondition<Long> timeCondition, Predicate<E> extraPredicate) {
+    protected int getStartIndexFor(TimeRangeCondition timeCondition, Predicate<E> extraPredicate) {
         if (fIntervals.isEmpty()) {
             return 0;
         }
@@ -967,7 +967,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
     }
 
     @Override
-    public Collection<Integer> selectNextChildren(RangeCondition<Long> timeCondition)
+    public Collection<Integer> selectNextChildren(TimeRangeCondition timeCondition)
             throws RangeException {
         CoreNodeData extraData = fExtraData;
         if (extraData != null) {
index c15a7f120db163f9de3c282f6669f632bf2b09e4..2309d9073c1c5937f42a86c2a14f30676fb8f40e 100644 (file)
@@ -16,7 +16,7 @@ import java.util.Collections;
 import java.util.function.Predicate;
 
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.exceptions.RangeException;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
 
@@ -166,7 +166,7 @@ public interface IHTNode<E extends IHTInterval> {
      *            matching this predicate will be returned.
      * @return Iterable of the elements in this node matching the condtions
      */
-    Iterable<E> getMatchingIntervals(RangeCondition<Long> timeCondition,
+    Iterable<E> getMatchingIntervals(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate);
 
     /**
@@ -180,7 +180,7 @@ public interface IHTNode<E extends IHTInterval> {
      * @return An interval matching the conditions or <code>null</code> if no
      *         interval was found
      */
-    @Nullable E getMatchingInterval(RangeCondition<Long> timeCondition,
+    @Nullable E getMatchingInterval(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate);
 
     /**
@@ -279,7 +279,7 @@ public interface IHTNode<E extends IHTInterval> {
      * @throws RangeException
      *             If t is out of the node's range
      */
-    default Collection<Integer> selectNextChildren(RangeCondition<Long> timeCondition) {
+    default Collection<Integer> selectNextChildren(TimeRangeCondition timeCondition) {
         return Collections.emptyList();
     }
 
index 3e2d8e6d69900dade81b663ce9ee627e61f9a3e7..988735105eb59400a08aa973ec742f731994863a 100644 (file)
@@ -16,7 +16,7 @@ import java.nio.channels.ClosedChannelException;
 import java.util.function.Predicate;
 
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.exceptions.RangeException;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
 
@@ -148,7 +148,7 @@ public interface IHistoryTree<E extends IHTInterval> {
      *            Iterable.
      * @return An Iterable of the matching elements
      */
-    Iterable<E> getMatchingIntervals(RangeCondition<Long> timeCondition,
+    Iterable<E> getMatchingIntervals(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate);
 
     /**
@@ -166,7 +166,7 @@ public interface IHistoryTree<E extends IHTInterval> {
      * @return An interval matching the given conditions, or <code>null</code>
      *         if no interval was found.
      */
-    @Nullable E getMatchingInterval(RangeCondition<Long> timeCondition,
+    @Nullable E getMatchingInterval(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate);
 
     // ------------------------------------------------------------------------
index dec813d76a0defc86974dcb5c6c00fe6d24299e5..9b8db43666cb13b32f143f7427d07ade95edfb52 100644 (file)
@@ -13,7 +13,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.AbstractHistoryTree;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTIntervalReader;
@@ -139,7 +139,7 @@ public class ClassicHistoryTree<E extends IHTInterval>
     protected boolean verifyIntersectingChildren(ClassicNode<E> parent, ClassicNode<E> child) {
         int childSequence = child.getSequenceNumber();
         for (long t = parent.getNodeStart(); t < parent.getNodeEnd(); t++) {
-            RangeCondition<Long> timeCondition = RangeCondition.singleton(t);
+            TimeRangeCondition timeCondition = TimeRangeCondition.singleton(t);
             boolean shouldBeInCollection = timeCondition.intersects(child.getNodeStart(), child.getNodeEnd());
             Collection<Integer> nextChildren = parent.selectNextChildren(timeCondition);
             /* There should be only one intersecting child */
index 017c4521bc90322fe6ed055e6c34d8f6fd7e094b..c5c610f4e741361a98eec39e4fa440b6ac925adc 100644 (file)
@@ -21,7 +21,7 @@ import java.util.Objects;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.exceptions.RangeException;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.HTNode;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.IHTNode;
@@ -127,7 +127,7 @@ public class ClassicNode<E extends IHTInterval> extends HTNode<E> {
         }
 
         @Override
-        protected Collection<Integer> selectNextIndices(RangeCondition<Long> rc) {
+        protected Collection<Integer> selectNextIndices(TimeRangeCondition rc) {
             ClassicNode<?> node = getNode();
 
             if (rc.min() < node.getNodeStart()
index 502d53401c895ff8730f83b9acf439b6465b2652..92d391b31b013dcef0bb8fc6b02a46ad7487e2da 100644 (file)
@@ -13,7 +13,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.AbstractHistoryTree;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTIntervalReader;
@@ -146,7 +146,7 @@ public abstract class AbstractOverlappingHistoryTree<E extends IHTInterval, N ex
         boolean shouldBeInCollection;
         Collection<Integer> nextChildren;
         for (long t = parent.getNodeStart(); t < parent.getNodeEnd(); t++) {
-            RangeCondition<Long> timeCondition = RangeCondition.singleton(t);
+            TimeRangeCondition timeCondition = TimeRangeCondition.singleton(t);
             shouldBeInCollection = (timeCondition.intersects(child.getNodeStart(), child.getNodeEnd()));
             nextChildren = parent.selectNextChildren(timeCondition);
             if (shouldBeInCollection != nextChildren.contains(childSequence)) {
index 37c815a38861c87d3837c733fdc427b270787dff..b8bac8afef7dab3dfc245c2fabf6d5ebd0cb003f 100644 (file)
@@ -23,7 +23,7 @@ import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.RangeCondition;
+import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.HTNode;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.IHTNode;
 import org.eclipse.tracecompass.internal.provisional.datastore.core.interval.IHTInterval;
@@ -181,7 +181,7 @@ public class OverlappingNode<E extends IHTInterval> extends HTNode<E> {
         }
 
         @Override
-        protected Collection<Integer> selectNextIndices(RangeCondition<Long> rc) {
+        protected Collection<Integer> selectNextIndices(TimeRangeCondition rc) {
             OverlappingNode<?> node = getNode();
 
             if (rc.max() < node.getNodeStart()
This page took 0.037557 seconds and 5 git commands to generate.