tmf: Fold IStateSystemQuerier2 back into IStateSystemQuerier
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 3 Aug 2012 16:59:09 +0000 (12:59 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 6 Aug 2012 18:06:45 +0000 (14:06 -0400)
Let's make use of the API break to re-simplify those interfaces.
Also dropped one of the range query methods, it is covered by
the new one.

Change-Id: If473d55983604b0cb52182009d1e79d4b9809eb7
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/7102
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>

org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/IStateSystemQuerier.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/IStateSystemQuerier2.java [deleted file]

index 762d9ced0d311a00b942e7147751d06d2f99f340..fef9fb672d23d6daeacba9f1f1627206e0244953 100644 (file)
@@ -225,7 +225,7 @@ public class StateSystemFullHistoryTest {
         List<ITmfStateInterval> intervals;
 
         quark = ssq.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
-        intervals = ssq.queryHistoryRange(quark, time1, time2, resolution);
+        intervals = ssq.queryHistoryRange(quark, time1, time2, resolution, null);
         assertEquals(126, intervals.size()); /* Number of context switches! */
         assertEquals(1452, intervals.get(50).getStateValue().unboxInt());
         assertEquals(1331668248815698779L, intervals.get(100).getEndTime());
index 45e913fa73f5892852f25fdf9b266c33c33a3364..1b9abe4319932b32986afc010f916a5441997024 100644 (file)
@@ -43,7 +43,6 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfStateSystemBuildCompleted;\r
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
 import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier;\r
-import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier2;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;\r
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
@@ -673,7 +672,7 @@ public class ControlFlowView extends TmfView {
         if (endTime <= startTime) {\r
             return null;\r
         }\r
-        IStateSystemQuerier2 ssq = (IStateSystemQuerier2) entry.getTrace().getStateSystem();\r
+        IStateSystemQuerier ssq = entry.getTrace().getStateSystem();\r
         List<ITimeEvent> eventList = null;\r
         try {\r
             int statusQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.STATUS);\r
index 4fb79a47f56af6cc1beef334dd84a3dc8ffdb295..66bc22c1cbceed38f35bc4f6727f3326d2ba23ba 100644 (file)
@@ -40,7 +40,6 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfStateSystemBuildCompleted;\r
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
 import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier;\r
-import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier2;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;\r
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
@@ -507,7 +506,7 @@ public class ResourcesView extends TmfView {
     private static List<ITimeEvent> getEventList(ResourcesEntry entry,\r
             long startTime, long endTime, long resolution, boolean includeNull,\r
             IProgressMonitor monitor) {\r
-        IStateSystemQuerier2 ssq = (IStateSystemQuerier2) entry.getTrace().getStateSystem();\r
+        IStateSystemQuerier ssq = entry.getTrace().getStateSystem();\r
         startTime = Math.max(startTime, ssq.getStartTime());\r
         endTime = Math.min(endTime, ssq.getCurrentEndTime() + 1);\r
         if (endTime <= startTime) {\r
index 750b477f66e0f8b6444580dcc56ebeca2e5a33b9..b87c83176560504473202742c90c39c770058b3a 100644 (file)
@@ -28,7 +28,6 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.interval.TmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemBuilder;
-import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier2;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
 import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
 
@@ -45,7 +44,7 @@ import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
  * @author alexmont
  *
  */
-public class StateSystem implements IStateSystemBuilder, IStateSystemQuerier2{
+public class StateSystem implements IStateSystemBuilder {
 
     /* References to the inner structures */
     private final AttributeTree attributeTree;
@@ -521,19 +520,16 @@ public class StateSystem implements IStateSystemBuilder, IStateSystemQuerier2{
 
     @Override
     public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
-            long t1, long t2, long resolution) throws TimeRangeException,
-            AttributeNotFoundException {
-        return queryHistoryRange(attributeQuark, t1, t2, resolution, new NullProgressMonitor());
-    }
-
-    @Override
-    public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
-            long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException,
-            AttributeNotFoundException {
+            long t1, long t2, long resolution, IProgressMonitor monitor)
+            throws TimeRangeException, AttributeNotFoundException {
         List<ITmfStateInterval> intervals;
         ITmfStateInterval currentInterval;
         long ts, tEnd;
 
+        if (monitor == null) {
+            monitor = new NullProgressMonitor();
+        }
+
         /* Make sure the time range makes sense */
         if (t2 < t1 || resolution <= 0) {
             throw new TimeRangeException();
index 1e1a68f75947dc444a08f883591878b23f19e8b7..4109255aa5188e6a264b8ef279833e396d7eb1fc 100644 (file)
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.tmf.core.statesystem;
 
 import java.util.List;
 
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
@@ -23,7 +24,7 @@ import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
  * This is the read-only interface to the generic state system. It contains all
  * the read-only quark-getting methods, as well as the history-querying ones.
  *
- * @version 1.0
+ * @version 2.0
  * @author Alexandre Montplaisir
  */
 public interface IStateSystemQuerier {
@@ -251,7 +252,8 @@ public interface IStateSystemQuerier {
     /**
      * Return the state history of a given attribute, but with at most one
      * update per "resolution". This can be useful for populating views (where
-     * it's useless to have more than one query per pixel, for example).
+     * it's useless to have more than one query per pixel, for example). A
+     * progress monitor can be used to cancel the query before completion.
      *
      * @param attributeQuark
      *            Which attribute this query is interested in
@@ -263,14 +265,19 @@ public interface IStateSystemQuerier {
      *            history.
      * @param resolution
      *            The "step" of this query
+     * @param monitor
+     *            A progress monitor. If the monitor is canceled during a query,
+     *            we will return what has been found up to that point. You can
+     *            use "null" if you do not want to use one.
      * @return The List of states that happened between t1 and t2
      * @throws TimeRangeException
      *             If t1 is invalid, if t2 <= t1, or if the resolution isn't
      *             greater than zero.
      * @throws AttributeNotFoundException
      *             If the attribute doesn't exist
+     * @since 2.0
      */
     public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
-            long t1, long t2, long resolution) throws TimeRangeException,
-            AttributeNotFoundException;
+            long t1, long t2, long resolution, IProgressMonitor monitor)
+            throws TimeRangeException, AttributeNotFoundException;
 }
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/IStateSystemQuerier2.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/IStateSystemQuerier2.java
deleted file mode 100644 (file)
index 32f73e2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * 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
- *
- * Contributors:
- *   Patrick Tasse - IStateSystemQuerier API augmented for bug 382910
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.statesystem;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
-import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
-import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
-
-/**
- * This interface augments the base interface IStateSystemQuerier.
- *
- * @version 1.1
- * @author Patrick Tasse
- * @since 1.1
- */
-public interface IStateSystemQuerier2 extends IStateSystemQuerier {
-
-    /**
-     * Return the state history of a given attribute, but with at most one
-     * update per "resolution". This can be useful for populating views (where
-     * it's useless to have more than one query per pixel, for example).
-     * A progress monitor can be used to cancel the query before completion.
-     *
-     * @param attributeQuark
-     *            Which attribute this query is interested in
-     * @param t1
-     *            Start time of the range query
-     * @param t2
-     *            Target end time of the query. If t2 is greater than the end of
-     *            the trace, we will return what we have up to the end of the
-     *            history.
-     * @param resolution
-     *            The "step" of this query
-     * @param monitor
-     *            A progress monitor. If the monitor is canceled during a query,
-     *            we will return what has been found up to that point.
-     * @return The List of states that happened between t1 and t2
-     * @throws TimeRangeException
-     *             If t1 is invalid, if t2 <= t1, or if the resolution isn't
-     *             greater than zero.
-     * @throws AttributeNotFoundException
-     *             If the attribute doesn't exist
-     * @since 1.1
-     */
-    public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
-            long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException,
-            AttributeNotFoundException;
-}
This page took 0.030259 seconds and 5 git commands to generate.