tmf: Don't return -1 for interval end times in the TransientState
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 21 Jan 2014 21:09:36 +0000 (16:09 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 21 Jan 2014 21:50:42 +0000 (16:50 -0500)
This might make sense locally to this class, but no other component
anywhere uses -1 for an end time value. Plus it breaks the contract
checked at construction that the end time should always be > the start
time.

Instead of returning a dummy -1, return the latest known end time. This
is just as "wrong", but eventually we could augment to API to indicate
if it read a real interval or a current state.

Change-Id: Ia9a23f990dce3301c721996e75219bc34ed1164f
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/20903
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/TransientState.java

index ff08a7c20e8d5bf0b7aa70e4c6d8ebedd8abf398..395e79eef1711f07abe046a0d174bd55516df7c9 100644 (file)
@@ -126,20 +126,19 @@ public class TransientState {
 
     /**
      * Convenience method to return the "ongoing" value for a given attribute as
-     * a dummy interval whose end time = -1 (since we don't know its real end
-     * time yet).
+     * a dummy interval whose end time = the current latest time.
      *
      * @param quark
      *            The quark of the attribute
      * @return An interval representing the current state (but whose end time is
-     *         meaningless)
+     *         the current one, and probably not the "final" one)
      * @throws AttributeNotFoundException
      *             If the quark is invalid
      */
     public ITmfStateInterval getOngoingInterval(int quark) throws AttributeNotFoundException {
         checkValidAttribute(quark);
-        return new TmfStateInterval(ongoingStateStartTimes.get(quark), -1, quark,
-                ongoingStateInfo.get(quark));
+        return new TmfStateInterval(ongoingStateStartTimes.get(quark), latestTime,
+                quark, ongoingStateInfo.get(quark));
     }
 
     private void checkValidAttribute(int quark) throws AttributeNotFoundException {
This page took 0.03661 seconds and 5 git commands to generate.