From c2e3f4dda82cef19b112aeb617fd5ea349a11d0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Genevi=C3=A8ve=20Bastien?= Date: Tue, 21 Feb 2017 10:39:05 -0500 Subject: [PATCH] datastore: Use time conditions with long MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://git.eclipse.org/r/91754 Reviewed-by: Hudson CI Reviewed-by: Loic Prieur-Drevon --- .../ContinuousTimeRangeConditionTest.java | 94 ++++++++++++++++ .../SingletonTimeRangeConditionTest.java | 79 +++++++++++++ .../ContinuousTimeRangeCondition.java | 72 ++++++++++++ .../SingletonTimeRangeCondition.java | 62 +++++++++++ .../core/condition/TimeRangeCondition.java | 104 ++++++++++++++++++ .../core/historytree/AbstractHistoryTree.java | 10 +- .../datastore/core/historytree/HTNode.java | 20 ++-- .../datastore/core/historytree/IHTNode.java | 8 +- .../core/historytree/IHistoryTree.java | 6 +- .../classic/ClassicHistoryTree.java | 4 +- .../core/historytree/classic/ClassicNode.java | 4 +- .../AbstractOverlappingHistoryTree.java | 4 +- .../overlapping/OverlappingNode.java | 4 +- 13 files changed, 441 insertions(+), 30 deletions(-) create mode 100644 statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeConditionTest.java create mode 100644 statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeConditionTest.java create mode 100644 statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeCondition.java create mode 100644 statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeCondition.java create mode 100644 statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/condition/TimeRangeCondition.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 index 0000000000..ecdc952bd2 --- /dev/null +++ b/statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeConditionTest.java @@ -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 index 0000000000..90ec0ee52e --- /dev/null +++ b/statesystem/org.eclipse.tracecompass.datastore.core.tests/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeConditionTest.java @@ -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 index 0000000000..3cf41c1e17 --- /dev/null +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/ContinuousTimeRangeCondition.java @@ -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 index 0000000000..dd6421bbd1 --- /dev/null +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/condition/SingletonTimeRangeCondition.java @@ -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 index 0000000000..80184b2df8 --- /dev/null +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/condition/TimeRangeCondition.java @@ -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 true if the value is + * between the lower and upper bounds. If the range is discrete, it will + * return true 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. + * null 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 null 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); + } + +} diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/AbstractHistoryTree.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/AbstractHistoryTree.java index 598aa0ed7c..85df36becf 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/AbstractHistoryTree.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/AbstractHistoryTree.java @@ -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 getMatchingIntervals(RangeCondition timeCondition, + public Iterable getMatchingIntervals(TimeRangeCondition timeCondition, Predicate extraPredicate) { // TODO Change this to evaluate the nodes lazily @@ -890,7 +890,7 @@ public abstract class AbstractHistoryTree currentNode = readNode(sequenceNumber); - RangeCondition nodeCondition = timeCondition.subCondition( + TimeRangeCondition nodeCondition = timeCondition.subCondition( currentNode.getNodeStart(), currentNode.getNodeEnd()); if (nodeCondition == null) { @@ -910,7 +910,7 @@ public abstract class AbstractHistoryTree timeCondition, + public @Nullable E getMatchingInterval(TimeRangeCondition timeCondition, Predicate extraPredicate) { /* Queue a stack of nodes containing nodes intersecting t */ @@ -1014,7 +1014,7 @@ public abstract class AbstractHistoryTree 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; } diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/HTNode.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/HTNode.java index 2d6054f9d2..0f214da215 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/HTNode.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/HTNode.java @@ -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 implements IHTNode { * @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 selectNextChildren(RangeCondition timeCondition) { + public final Collection selectNextChildren(TimeRangeCondition timeCondition) { fNode.takeReadLock(); try { return selectNextIndices(timeCondition).stream() @@ -338,7 +338,7 @@ public class HTNode implements IHTNode { * @return Collection of the indices of the child nodes that intersect * the time condition */ - protected Collection selectNextIndices(RangeCondition timeCondition) { + protected Collection selectNextIndices(TimeRangeCondition timeCondition) { /* By default, all children are returned */ List childList = new ArrayList<>(); for (int i = 0; i < fNbChildren; i++) { @@ -579,7 +579,7 @@ public class HTNode implements IHTNode { * 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 implements IHTNode { } @Override - public Iterable getMatchingIntervals(RangeCondition timeCondition, + public Iterable getMatchingIntervals(TimeRangeCondition timeCondition, Predicate extraPredicate) { // TODO Benchmark using/returning streams instead of iterables @@ -699,7 +699,7 @@ public class HTNode implements IHTNode { } @Override - public @Nullable E getMatchingInterval(RangeCondition timeCondition, Predicate extraPredicate) { + public @Nullable E getMatchingInterval(TimeRangeCondition timeCondition, Predicate extraPredicate) { if (isOnDisk()) { return doGetMatchingInterval(timeCondition, extraPredicate); } @@ -713,7 +713,7 @@ public class HTNode implements IHTNode { } } - private Iterable doGetMatchingIntervals(RangeCondition timeCondition, + private Iterable doGetMatchingIntervals(TimeRangeCondition timeCondition, Predicate extraPredicate) { List list = new ArrayList<>(); for (int i = getStartIndexFor(timeCondition, extraPredicate); i < fIntervals.size(); i++) { @@ -726,7 +726,7 @@ public class HTNode implements IHTNode { return list; } - private @Nullable E doGetMatchingInterval(RangeCondition timeCondition, + private @Nullable E doGetMatchingInterval(TimeRangeCondition timeCondition, Predicate extraPredicate) { for (int i = getStartIndexFor(timeCondition, extraPredicate); i < fIntervals.size(); i++) { E curInterval = fIntervals.get(i); @@ -755,7 +755,7 @@ public class HTNode implements IHTNode { * @return The index of the first interval greater than or equal to the * conditions in parameter */ - protected int getStartIndexFor(RangeCondition timeCondition, Predicate extraPredicate) { + protected int getStartIndexFor(TimeRangeCondition timeCondition, Predicate extraPredicate) { if (fIntervals.isEmpty()) { return 0; } @@ -967,7 +967,7 @@ public class HTNode implements IHTNode { } @Override - public Collection selectNextChildren(RangeCondition timeCondition) + public Collection selectNextChildren(TimeRangeCondition timeCondition) throws RangeException { CoreNodeData extraData = fExtraData; if (extraData != null) { diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHTNode.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHTNode.java index c15a7f120d..2309d9073c 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHTNode.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHTNode.java @@ -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 { * matching this predicate will be returned. * @return Iterable of the elements in this node matching the condtions */ - Iterable getMatchingIntervals(RangeCondition timeCondition, + Iterable getMatchingIntervals(TimeRangeCondition timeCondition, Predicate extraPredicate); /** @@ -180,7 +180,7 @@ public interface IHTNode { * @return An interval matching the conditions or null if no * interval was found */ - @Nullable E getMatchingInterval(RangeCondition timeCondition, + @Nullable E getMatchingInterval(TimeRangeCondition timeCondition, Predicate extraPredicate); /** @@ -279,7 +279,7 @@ public interface IHTNode { * @throws RangeException * If t is out of the node's range */ - default Collection selectNextChildren(RangeCondition timeCondition) { + default Collection selectNextChildren(TimeRangeCondition timeCondition) { return Collections.emptyList(); } diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHistoryTree.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHistoryTree.java index 3e2d8e6d69..988735105e 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHistoryTree.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/IHistoryTree.java @@ -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 { * Iterable. * @return An Iterable of the matching elements */ - Iterable getMatchingIntervals(RangeCondition timeCondition, + Iterable getMatchingIntervals(TimeRangeCondition timeCondition, Predicate extraPredicate); /** @@ -166,7 +166,7 @@ public interface IHistoryTree { * @return An interval matching the given conditions, or null * if no interval was found. */ - @Nullable E getMatchingInterval(RangeCondition timeCondition, + @Nullable E getMatchingInterval(TimeRangeCondition timeCondition, Predicate extraPredicate); // ------------------------------------------------------------------------ diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicHistoryTree.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicHistoryTree.java index dec813d76a..9b8db43666 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicHistoryTree.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicHistoryTree.java @@ -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 protected boolean verifyIntersectingChildren(ClassicNode parent, ClassicNode child) { int childSequence = child.getSequenceNumber(); for (long t = parent.getNodeStart(); t < parent.getNodeEnd(); t++) { - RangeCondition timeCondition = RangeCondition.singleton(t); + TimeRangeCondition timeCondition = TimeRangeCondition.singleton(t); boolean shouldBeInCollection = timeCondition.intersects(child.getNodeStart(), child.getNodeEnd()); Collection nextChildren = parent.selectNextChildren(timeCondition); /* There should be only one intersecting child */ diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java index 017c4521bc..c5c610f4e7 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java @@ -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 extends HTNode { } @Override - protected Collection selectNextIndices(RangeCondition rc) { + protected Collection selectNextIndices(TimeRangeCondition rc) { ClassicNode node = getNode(); if (rc.min() < node.getNodeStart() diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/AbstractOverlappingHistoryTree.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/AbstractOverlappingHistoryTree.java index 502d53401c..92d391b31b 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/AbstractOverlappingHistoryTree.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/AbstractOverlappingHistoryTree.java @@ -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 nextChildren; for (long t = parent.getNodeStart(); t < parent.getNodeEnd(); t++) { - RangeCondition 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)) { diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/OverlappingNode.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/OverlappingNode.java index 37c815a388..b8bac8afef 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/OverlappingNode.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/overlapping/OverlappingNode.java @@ -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 extends HTNode { } @Override - protected Collection selectNextIndices(RangeCondition rc) { + protected Collection selectNextIndices(TimeRangeCondition rc) { OverlappingNode node = getNode(); if (rc.max() < node.getNodeStart() -- 2.34.1