tmf: Simple warning fixes in tmf.core and tests
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 14 Jun 2012 22:49:19 +0000 (18:49 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 18 Jun 2012 19:53:22 +0000 (15:53 -0400)
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
48 files changed:
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/component/TmfEventProviderTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTypeTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedDataRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfDataRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfEventRequestTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfContextTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/uml2sd/TmfAsyncSequenceDiagramEventTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/uml2sd/TmfSyncSequenceDiagramEventTest.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfClientStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEmptyTraceStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfExperimentStub.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Tracer.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/component/TmfProviderManager.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/component/TmfThread.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedDataRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfCoalescedEventRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfRequestExecutor.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfExperimentContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfExperimentLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfEvent.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfSimpleTimestamp.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterCompareNode.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterContainsNode.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterEqualsNode.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterEventTypeNode.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/xml/TmfFilterXMLParser.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/xml/TmfFilterXMLWriter.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/io/BufferedRandomAccessFile.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/request/ITmfDataRequest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceIndexer.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/util/TmfFixedArray.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterManager.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterView.java

index eb254bb750674f91487252bec05600e935f3dcf8..bc4dd1291c04a8ae77216930975e579848aca76d 100644 (file)
@@ -1,18 +1,17 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.tests.component;
 
-import java.io.IOException;
 import java.util.Vector;
 
 import junit.framework.TestCase;
@@ -41,7 +40,7 @@ public class TmfEventProviderTest extends TestCase {
     TmfEventProviderStub fEventProvider;
     TmfSyntheticEventProviderStub fSyntheticEventProvider;
 
-    public TmfEventProviderTest(String name) throws IOException {
+    public TmfEventProviderTest(String name) {
         super(name);
     }
 
@@ -234,7 +233,8 @@ public class TmfEventProviderTest extends TestCase {
     }
 
     @SuppressWarnings("unchecked")
-    private void getSyntheticData(final TmfTimeRange range, final int nbEvents, final int blockSize) throws InterruptedException {
+    private static void getSyntheticData(final TmfTimeRange range,
+            final int nbEvents, final int blockSize) throws InterruptedException {
 
         final Vector<TmfSyntheticEventStub> requestedEvents = new Vector<TmfSyntheticEventStub>();
 
@@ -254,8 +254,9 @@ public class TmfEventProviderTest extends TestCase {
         provider.sendRequest(request);
 
         request.waitForCompletion();
-        if (nbEvents != -1)
+        if (nbEvents != -1) {
             assertEquals("nbEvents", nbEvents, requestedEvents.size());
+        }
         assertTrue("isCompleted", request.isCompleted());
         assertFalse("isCancelled", request.isCancelled());
 
index 77179e4226288d649e4f282ef1cd58036cca2ad7..5b0fe7a49fe90bff2cbddd3e2a79e19928319c13 100644 (file)
@@ -23,7 +23,6 @@ public class CtfLocationTest {
      *
      * @generatedBy CodePro at 03/05/12 2:29 PM
      */
-    @SuppressWarnings("static-method")
     @Test
     public void testCtfLocation_1() {
         Long location = Long.valueOf(1);
@@ -40,7 +39,6 @@ public class CtfLocationTest {
      *
      * @generatedBy CodePro at 03/05/12 2:29 PM
      */
-    @SuppressWarnings("static-method")
     @Test
     public void testCtfLocation_2() {
         ITmfTimestamp timestamp = new TmfTimestamp();
@@ -57,7 +55,6 @@ public class CtfLocationTest {
      *
      * @generatedBy CodePro at 03/05/12 2:29 PM
      */
-    @SuppressWarnings("static-method")
     @Test
     public void testClone_1() {
         CtfLocation fixture = new CtfLocation(Long.valueOf(1));
@@ -75,7 +72,6 @@ public class CtfLocationTest {
      *
      * @generatedBy CodePro at 03/05/12 2:29 PM
      */
-    @SuppressWarnings("static-method")
     @Test
     public void testGetLocation_1() {
         CtfLocation fixture = new CtfLocation(Long.valueOf(1));
@@ -99,7 +95,6 @@ public class CtfLocationTest {
      *
      * @generatedBy CodePro at 03/05/12 2:29 PM
      */
-    @SuppressWarnings("static-method")
     @Test
     public void testSetLocation_1() {
         CtfLocation fixture = new CtfLocation(Long.valueOf(1));
@@ -111,14 +106,12 @@ public class CtfLocationTest {
         // add additional test code here
     }
 
-    @SuppressWarnings("static-method")
     @Test
     public void testToString1(){
         CtfLocation fixture = new CtfLocation(new Long(1337L));
         assertEquals("CtfLocation: 1337",fixture.toString()); //$NON-NLS-1$
     }
 
-    @SuppressWarnings("static-method")
     @Test
     public void testToString2(){
         CtfLocation fixture = new CtfLocation(new Long(-1L));
index 8388fcd6f204fd7f29a73e01f3513081b2bb4a49..ddbc8ddf0fed25bfd8c4cacd9cddaa6750ee3bba 100644 (file)
@@ -4,8 +4,6 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.io.FileNotFoundException;
-
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
index 69dba2413b603aff8aa8157ba521759705255558..a509ea07cb7046d5a8435af5b5ce75c494c4b0dd 100644 (file)
@@ -71,7 +71,7 @@ public class CtfTmfTraceTest {
      * @return
      * @throws TmfTraceException
      */
-    private CtfTmfTrace initTrace() throws TmfTraceException {
+    private static CtfTmfTrace initTrace() throws TmfTraceException {
         CtfTmfTrace fixture = new CtfTmfTrace();
         fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class);
         return fixture;
index a87beae1393f9c976437da1a4788760260cee992..139f1361c43dfe2aaae8af3e0dd66b31aa55192f 100644 (file)
@@ -32,8 +32,8 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 
 /**
@@ -48,7 +48,7 @@ public class TmfEventTest extends TestCase {
 
     private final String fSource = "Source";
 
-    private final String fContext = TmfEventType.DEFAULT_CONTEXT_ID;
+    private final String fContext = ITmfEventType.DEFAULT_CONTEXT_ID;
     private final String fTypeId = "TestType";
     private final String fLabel1 = "AString";
     private final String fLabel2 = "AnInteger";
@@ -104,7 +104,7 @@ public class TmfEventTest extends TestCase {
     // Helper functions
     // ------------------------------------------------------------------------
 
-    private TmfTraceStub openTrace() {
+    private static TmfTraceStub openTrace() {
         final String DIRECTORY = "testfiles";
         final String TEST_STREAM = "A-Test-10K";
         final String path = DIRECTORY + File.separator + TEST_STREAM;
@@ -131,7 +131,7 @@ public class TmfEventTest extends TestCase {
     public void testDefaultConstructor() {
         final ITmfEvent event = new TmfEvent();
         assertNull("getTrace", event.getTrace());
-        assertEquals("getRank", TmfContext.UNKNOWN_RANK, event.getRank());
+        assertEquals("getRank", ITmfContext.UNKNOWN_RANK, event.getRank());
         assertNull("getTimestamp", event.getTimestamp());
         assertNull("getSource", event.getSource());
         assertNull("getType", event.getType());
@@ -160,7 +160,7 @@ public class TmfEventTest extends TestCase {
     public void testNoRankConstructor() {
         final TmfEvent event = new TmfEvent(null, fTimestamp1, fSource, fType, fContent1, fReference1);
         assertNull("getTrace", event.getTrace());
-        assertEquals("getRank", TmfContext.UNKNOWN_RANK, event.getRank());
+        assertEquals("getRank", ITmfContext.UNKNOWN_RANK, event.getRank());
         assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
         assertEquals("getSource", fSource, event.getSource());
         assertEquals("getType", fType, event.getType());
index 8d09a36235c78c07888c12ce87797b4d3298c57a..9eb1b1dfa99321a4260e36b862302da6f97fc311 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 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:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Adjusted for new Event Model
@@ -74,8 +74,8 @@ public class TmfEventTypeTest extends TestCase {
 
     public void testDefaultConstructor() {
         final ITmfEventType type = new TmfEventType();
-        assertEquals("getContext", TmfEventType.DEFAULT_CONTEXT_ID, type.getContext());
-        assertEquals("getName", TmfEventType.DEFAULT_TYPE_ID, type.getName());
+        assertEquals("getContext", ITmfEventType.DEFAULT_CONTEXT_ID, type.getContext());
+        assertEquals("getName", ITmfEventType.DEFAULT_TYPE_ID, type.getName());
         assertNull("getRootField", type.getRootField());
         assertEquals("getFieldNames", 0, type.getFieldNames().length);
         assertNull("getFieldName", type.getFieldName(0));
@@ -88,8 +88,9 @@ public class TmfEventTypeTest extends TestCase {
         assertEquals("getRootField", TmfEventField.makeRoot(fLabels0), type0.getRootField());
         final String[] labels0 = type0.getFieldNames();
         assertEquals("getFieldNames length", fLabels0.length, labels0.length);
-        for (int i = 0; i < labels0.length; i++)
+        for (int i = 0; i < labels0.length; i++) {
             assertEquals("getFieldNames", fLabels0[i], labels0[i]);
+        }
         assertNull("getFieldName", type0.getFieldName(labels0.length));
 
         final ITmfEventType type1 = new TmfEventType(fContext1, fTypeId1, TmfEventField.makeRoot(fLabels1));
@@ -98,8 +99,9 @@ public class TmfEventTypeTest extends TestCase {
         assertEquals("getRootField", TmfEventField.makeRoot(fLabels1), type1.getRootField());
         final String[] labels1 = type1.getFieldNames();
         assertEquals("getFieldNames length", fLabels1.length, labels1.length);
-        for (int i = 0; i < labels1.length; i++)
+        for (int i = 0; i < labels1.length; i++) {
             assertEquals("getFieldNames", fLabels1[i], labels1[i]);
+        }
         assertNull("getFieldName", type1.getFieldName(labels1.length));
 
         final ITmfEventType type2 = new TmfEventType(fContext2, fTypeId2, TmfEventField.makeRoot(fLabels2));
@@ -108,8 +110,9 @@ public class TmfEventTypeTest extends TestCase {
         assertEquals("getRootField", TmfEventField.makeRoot(fLabels2), type2.getRootField());
         final String[] labels2 = type2.getFieldNames();
         assertEquals("getFieldNames length", fLabels2.length, labels2.length);
-        for (int i = 0; i < labels2.length; i++)
+        for (int i = 0; i < labels2.length; i++) {
             assertEquals("getFieldNames", fLabels2[i], labels2[i]);
+        }
         assertNull("getFieldName", type2.getFieldName(labels2.length));
     }
 
@@ -136,8 +139,9 @@ public class TmfEventTypeTest extends TestCase {
         assertEquals("getRootField", TmfEventField.makeRoot(fLabels1), copy.getRootField());
         final String[] labels1 = copy.getFieldNames();
         assertEquals("getFieldNames length", fLabels1.length, labels1.length);
-        for (int i = 0; i < labels1.length; i++)
+        for (int i = 0; i < labels1.length; i++) {
             assertEquals("getFieldNames", fLabels1[i], labels1[i]);
+        }
         assertNull("getFieldName", copy.getFieldName(labels1.length));
     }
 
@@ -265,8 +269,8 @@ public class TmfEventTypeTest extends TestCase {
     // ------------------------------------------------------------------------
 
     public void testToString() {
-        final String expected1 = "TmfEventType [fContext=" + TmfEventType.DEFAULT_CONTEXT_ID +
-                ", fTypeId=" + TmfEventType.DEFAULT_TYPE_ID + "]";
+        final String expected1 = "TmfEventType [fContext=" + ITmfEventType.DEFAULT_CONTEXT_ID +
+                ", fTypeId=" + ITmfEventType.DEFAULT_TYPE_ID + "]";
         final TmfEventType type1 = new TmfEventType();
         assertEquals("toString", expected1, type1.toString());
 
index 4bdf3bb0100afdf5efd79c434f4d13f5c7cca1c6..9a196f1679d0b79c178d2e787ef02ebe7abac475 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -41,7 +41,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
        private TmfCoalescedDataRequest<TmfEvent> fRequest1c;
 
        private int fRequestCount;
-       
+
        // ------------------------------------------------------------------------
        // Housekeeping
        // ------------------------------------------------------------------------
@@ -70,8 +70,8 @@ public class TmfCoalescedDataRequestTest extends TestCase {
                super.tearDown();
        }
 
-       private TmfCoalescedDataRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
-               
+       private static TmfCoalescedDataRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
+
                TmfCoalescedDataRequest<TmfEvent> request = new TmfCoalescedDataRequest<TmfEvent>(TmfEvent.class, 10, 100, 200) {
                    @Override
                        public void handleCompleted() {
@@ -96,7 +96,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
                };
                return request;
        }
-       
+
        // ------------------------------------------------------------------------
        // Constructors
        // ------------------------------------------------------------------------
@@ -186,13 +186,13 @@ public class TmfCoalescedDataRequestTest extends TestCase {
         assertFalse("equals", fRequest3.equals(fRequest1));
         assertFalse("equals", fRequest3.equals(fRequest2));
        }
-       
+
        public void testEqualsTransivity() throws Exception {
         assertTrue("equals", fRequest1.equals(fRequest1b));
         assertTrue("equals", fRequest1b.equals(fRequest1c));
         assertTrue("equals", fRequest1.equals(fRequest1c));
        }
-       
+
        public void testEqualsNull() throws Exception {
         assertFalse("equals", fRequest1.equals(null));
         assertFalse("equals", fRequest2.equals(null));
@@ -207,7 +207,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
         assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
                assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
        }
-       
+
        // ------------------------------------------------------------------------
        // toString
        // ------------------------------------------------------------------------
@@ -352,7 +352,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testDone() {
-               
+
                // Test request
                final boolean[] crFlags = new boolean[4];
                TmfCoalescedDataRequest<TmfEvent> request = setupTestRequest(crFlags);
@@ -389,7 +389,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testFail() {
-               
+
                final boolean[] crFlags = new boolean[4];
                TmfCoalescedDataRequest<TmfEvent> request = setupTestRequest(crFlags);
                TmfDataRequest<TmfEvent> subRequest1 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 100, 200);
@@ -456,7 +456,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
                assertTrue ("isCancelled", subRequest2.isCancelled());
        }
 
-       
+
        // ------------------------------------------------------------------------
        // cancel sub-requests
        // ------------------------------------------------------------------------
@@ -480,7 +480,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
                // Validate the coalescing request
                assertFalse("isCompleted", request.isCompleted());
                assertFalse("isFailed",     request.isFailed());
-               assertFalse("isCancelled", request.isCancelled());  
+               assertFalse("isCancelled", request.isCancelled());
 
                // Cancel second sub-request
                subRequest2.cancel();
@@ -495,7 +495,7 @@ public class TmfCoalescedDataRequestTest extends TestCase {
                assertFalse("isFailed",    request.isFailed());
                assertTrue ("isCancelled", request.isCancelled());
 
-               // Finalize coalescing request - 
+               // Finalize coalescing request -
                // Note: No need to check "request.isCancelled()" since it was verified above
             request.cancel();
 
index 6a5cde095ceeab10b1b1393dce5edd0f2e9d44cc..d058342ef7f3814c061c6f611f0f67b531c80a4a 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -31,6 +31,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
@@ -51,9 +52,9 @@ public class TmfCoalescedEventRequestTest extends TestCase {
        // Variables
        // ------------------------------------------------------------------------
 
-       private TmfTimeRange range1 = new TmfTimeRange(TmfTimeRange.ETERNITY);
-       private TmfTimeRange range2 = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
-       
+       private final TmfTimeRange range1 = new TmfTimeRange(TmfTimeRange.ETERNITY);
+       private final TmfTimeRange range2 = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
+
        private TmfCoalescedEventRequest<TmfEvent> fRequest1;
        private TmfCoalescedEventRequest<TmfEvent> fRequest2;
        private TmfCoalescedEventRequest<TmfEvent> fRequest3;
@@ -63,7 +64,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
        private TmfCoalescedEventRequest<TmfEvent> fRequest1c;
 
        private int fRequestCount;
-       
+
        // ------------------------------------------------------------------------
        // Housekeeping
        // ------------------------------------------------------------------------
@@ -75,7 +76,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
        @Override
        public void setUp() throws Exception {
                super.setUp();
-               TmfEventRequest.reset();
+               TmfDataRequest.reset();
                fRequest1  = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range1, 100, 200);
                fRequest2  = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range2, 100, 200);
                fRequest3  = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range2, 200, 200);
@@ -93,7 +94,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
        }
 
        private TmfCoalescedEventRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
-               
+
                TmfCoalescedEventRequest<TmfEvent> request = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range1, 100, 200) {
                    @Override
                        public void handleCompleted() {
@@ -118,7 +119,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
                };
                return request;
        }
-       
+
        // ------------------------------------------------------------------------
        // Constructors
        // ------------------------------------------------------------------------
@@ -130,7 +131,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         assertEquals("getDataType",  TmfEvent.class, request.getDataType());
 
         assertEquals("getRange", range1, request.getRange());
-        assertEquals("getNbRequestedEvents", TmfEventRequest.ALL_DATA, request.getNbRequested());
+        assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
 
         assertFalse("isCompleted", request.isCompleted());
         assertFalse("isFailed", request.isFailed());
@@ -146,7 +147,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         assertEquals("getDataType",  TmfEvent.class, request.getDataType());
 
         assertEquals("getRange", range1, request.getRange());
-        assertEquals("getNbRequestedEvents", TmfEventRequest.ALL_DATA, request.getNbRequested());
+        assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
 
         assertFalse("isCompleted", request.isCompleted());
         assertFalse("isFailed", request.isFailed());
@@ -208,13 +209,13 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         assertFalse("equals", fRequest3.equals(fRequest1));
         assertFalse("equals", fRequest3.equals(fRequest2));
        }
-       
+
        public void testEqualsTransivity() throws Exception {
         assertTrue("equals", fRequest1.equals(fRequest1b));
         assertTrue("equals", fRequest1b.equals(fRequest1c));
         assertTrue("equals", fRequest1.equals(fRequest1c));
        }
-       
+
        public void testEqualsNull() throws Exception {
         assertFalse("equals", fRequest1.equals(null));
         assertFalse("equals", fRequest2.equals(null));
@@ -243,7 +244,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
                assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
        }
-       
+
        // ------------------------------------------------------------------------
        // toString
        // ------------------------------------------------------------------------
@@ -318,7 +319,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testDone() {
-               
+
                // Test request
                final boolean[] crFlags = new boolean[4];
                TmfCoalescedEventRequest<TmfEvent> request = setupTestRequest(crFlags);
@@ -355,7 +356,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testFail() {
-               
+
                final boolean[] crFlags = new boolean[4];
                TmfCoalescedEventRequest<TmfEvent> request = setupTestRequest(crFlags);
                TmfEventRequest<TmfEvent> subRequest1 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 200);
@@ -487,8 +488,9 @@ public class TmfCoalescedEventRequestTest extends TestCase {
                        super.handleData(event);
                if (!isCompleted()) {
                                requestedEvents1.add(event);
-                       if (++nbRead >= BLOCK_SIZE && signal.forceCancel)
-                               cancel();
+                       if (++nbRead >= BLOCK_SIZE && signal.forceCancel) {
+                        cancel();
+                    }
                }
             }
         };
@@ -546,7 +548,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         assertFalse ("Request3: isCancelled", request3.isCancelled());
 
         // Ensure that we have distinct events.
-        // Don't go overboard: we are not validating the stub! 
+        // Don't go overboard: we are not validating the stub!
         for (int i = 0; i < NB_EVENTS; i++) {
             assertEquals("Distinct events", i+1, requestedEvents1.get(i).getTimestamp().getValue());
             assertEquals("Distinct events", i+1, requestedEvents2.get(i).getTimestamp().getValue());
@@ -557,7 +559,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         fTrace.dispose();
         fTrace = null;
     }
-    
+
        public void testCancelCoalescedRequest() throws Exception {
 
                fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
@@ -583,7 +585,7 @@ public class TmfCoalescedEventRequestTest extends TestCase {
         assertFalse ("Request3: isCancelled", request3.isCancelled());
 
         // Ensure that we have distinct events.
-        // Don't go overboard: we are not validating the stub! 
+        // Don't go overboard: we are not validating the stub!
         for (int i = 0; i < NB_EVENTS; i++) {
             assertEquals("Distinct events", i+1, requestedEvents2.get(i).getTimestamp().getValue());
             assertEquals("Distinct events", i+1, requestedEvents3.get(i).getTimestamp().getValue());
index 7c12e4c6e83a4dde0f9fc72e39ce5e9c0a708d4a..8f91d59ed23c4437405a3ec2afd324832a1917ea 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -38,7 +38,7 @@ public class TmfDataRequestTest extends TestCase {
        private static TmfDataRequest<TmfEvent> fRequest4;
 
        private static int fRequestCount;
-       
+
     // ------------------------------------------------------------------------
        // Housekeeping
        // ------------------------------------------------------------------------
@@ -65,8 +65,8 @@ public class TmfDataRequestTest extends TestCase {
                super.tearDown();
        }
 
-       private TmfDataRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
-               
+       private static TmfDataRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
+
                TmfDataRequest<TmfEvent> request = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 100, 200) {
                    @Override
                        public void handleCompleted() {
@@ -91,7 +91,7 @@ public class TmfDataRequestTest extends TestCase {
                };
                return request;
        }
-       
+
        // ------------------------------------------------------------------------
        // Constructors
        // ------------------------------------------------------------------------
@@ -181,13 +181,13 @@ public class TmfDataRequestTest extends TestCase {
         assertFalse("equals", fRequest3.equals(fRequest1));
         assertFalse("equals", fRequest3.equals(fRequest2));
        }
-       
+
        public void testEqualsTransivity() throws Exception {
         assertTrue("equals", fRequest1.equals(fRequest1b));
         assertTrue("equals", fRequest1b.equals(fRequest1c));
         assertTrue("equals", fRequest1.equals(fRequest1c));
        }
-       
+
        public void testEqualsNull() throws Exception {
         assertFalse("equals", fRequest1.equals(null));
         assertFalse("equals", fRequest2.equals(null));
@@ -202,7 +202,7 @@ public class TmfDataRequestTest extends TestCase {
         assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
                assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
        }
-       
+
        // ------------------------------------------------------------------------
        // toString
        // ------------------------------------------------------------------------
@@ -224,7 +224,7 @@ public class TmfDataRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testDone() {
-               
+
                final boolean[] flags = new boolean[4];
                TmfDataRequest<TmfEvent> request = setupTestRequest(flags);
                request.done();
@@ -244,7 +244,7 @@ public class TmfDataRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testFail() {
-               
+
                final boolean[] flags = new boolean[4];
                TmfDataRequest<TmfEvent> request = setupTestRequest(flags);
                request.fail();
@@ -283,4 +283,4 @@ public class TmfDataRequestTest extends TestCase {
        // waitForCompletion
        // ------------------------------------------------------------------------
 
-}
\ No newline at end of file
+}
index 4c4a89f863d1d279390e48ba2b74b5458b629bd6..2ff23b7f5d5da2b4d89862f2e6397d5eb9b2fa02 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -35,7 +35,7 @@ public class TmfEventRequestTest extends TestCase {
 
        private static TmfTimeRange range1 = new TmfTimeRange(TmfTimeRange.ETERNITY);
        private static TmfTimeRange range2 = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
-       
+
        private static TmfEventRequest<TmfEvent> fRequest1;
        private static TmfEventRequest<TmfEvent> fRequest1b;
        private static TmfEventRequest<TmfEvent> fRequest1c;
@@ -44,7 +44,7 @@ public class TmfEventRequestTest extends TestCase {
        private static TmfEventRequest<TmfEvent> fRequest4;
 
        private static int fRequestCount;
-       
+
        // ------------------------------------------------------------------------
        // Housekeeping
        // ------------------------------------------------------------------------
@@ -71,8 +71,8 @@ public class TmfEventRequestTest extends TestCase {
                super.tearDown();
        }
 
-       private TmfEventRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
-               
+       private static TmfEventRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
+
                TmfEventRequest<TmfEvent> request = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, new TmfTimeRange(TmfTimeRange.ETERNITY), 100, 200) {
                    @Override
                        public void handleCompleted() {
@@ -97,7 +97,7 @@ public class TmfEventRequestTest extends TestCase {
                };
                return request;
        }
-       
+
        // ------------------------------------------------------------------------
        // Constructors
        // ------------------------------------------------------------------------
@@ -202,13 +202,13 @@ public class TmfEventRequestTest extends TestCase {
         assertFalse("equals", fRequest3.equals(fRequest1));
         assertFalse("equals", fRequest3.equals(fRequest2));
        }
-       
+
        public void testEqualsTransivity() throws Exception {
         assertTrue("equals", fRequest1.equals(fRequest1b));
         assertTrue("equals", fRequest1b.equals(fRequest1c));
         assertTrue("equals", fRequest1.equals(fRequest1c));
        }
-       
+
        public void testEqualsNull() throws Exception {
         assertFalse("equals", fRequest1.equals(null));
         assertFalse("equals", fRequest2.equals(null));
@@ -223,7 +223,7 @@ public class TmfEventRequestTest extends TestCase {
         assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
                assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
        }
-       
+
        // ------------------------------------------------------------------------
        // toString
        // ------------------------------------------------------------------------
@@ -245,7 +245,7 @@ public class TmfEventRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testDone() {
-               
+
                final boolean[] flags = new boolean[4];
                TmfEventRequest<TmfEvent> request = setupTestRequest(flags);
                request.done();
@@ -265,7 +265,7 @@ public class TmfEventRequestTest extends TestCase {
        // ------------------------------------------------------------------------
 
        public void testFail() {
-               
+
                final boolean[] flags = new boolean[4];
                TmfEventRequest<TmfEvent> request = setupTestRequest(flags);
                request.fail();
@@ -304,4 +304,4 @@ public class TmfEventRequestTest extends TestCase {
        // waitForCompletion
        // ------------------------------------------------------------------------
 
-}
\ No newline at end of file
+}
index 0a7cc9730421270315e41a0fe327d8c26c2aa10f..bb55409592b9f60157804c1dac2118ff2b6d64b3 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 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:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Adapted for TMF Trace Model 1.0
@@ -75,7 +75,7 @@ public class TmfContextTest extends TestCase {
     public void testTmfContextDefault() {
         final TmfContext context = new TmfContext();
         assertEquals("getLocation", null, context.getLocation());
-        assertEquals("getRank", TmfContext.UNKNOWN_RANK, context.getRank());
+        assertEquals("getRank", ITmfContext.UNKNOWN_RANK, context.getRank());
     }
 
     public void testTmfContextNoRank() {
@@ -87,9 +87,9 @@ public class TmfContextTest extends TestCase {
         assertEquals("getLocation", fLocation2, context2.getLocation());
         assertEquals("getLocation", fLocation3, context3.getLocation());
 
-        assertEquals("getRank", TmfContext.UNKNOWN_RANK, context1.getRank());
-        assertEquals("getRank", TmfContext.UNKNOWN_RANK, context2.getRank());
-        assertEquals("getRank", TmfContext.UNKNOWN_RANK, context3.getRank());
+        assertEquals("getRank", ITmfContext.UNKNOWN_RANK, context1.getRank());
+        assertEquals("getRank", ITmfContext.UNKNOWN_RANK, context2.getRank());
+        assertEquals("getRank", ITmfContext.UNKNOWN_RANK, context3.getRank());
     }
 
     public void testTmfContext() {
index 8a89d8e397fb977609a57bfaf9911907ed8fa399..30f1277572ac7541e3badccdbe50d6d9172d53e6 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 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:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Adjusted for new Trace Model
@@ -30,6 +30,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
@@ -184,7 +185,7 @@ public class TmfExperimentTest extends TestCase {
     // ------------------------------------------------------------------------
 
     public void testSeekBadLocation() throws Exception {
-        ITmfContext context = fExperiment.seekEvent((ITmfLocation<?>) new TmfLocation<Long>(0L));
+        ITmfContext context = fExperiment.seekEvent(new TmfLocation<Long>(0L));
         assertNull("seekEvent", context);
     }
 
@@ -215,21 +216,21 @@ public class TmfExperimentTest extends TestCase {
         event = fExperiment.parseEvent(context);
         assertEquals("Event timestamp", midTrace + 1, event.getTimestamp().getValue());
         assertEquals("Context rank", midTrace, context.getRank());
-        
+
         // Last event
         context = fExperiment.seekEvent(1.0);
         assertEquals("Context rank", NB_EVENTS, context.getRank());
         event = fExperiment.parseEvent(context);
         assertNull("Event timestamp", event);
         assertEquals("Context rank", NB_EVENTS, context.getRank());
-        
+
         // Beyond last event
         context = fExperiment.seekEvent(1.1);
         assertEquals("Context rank", NB_EVENTS, context.getRank());
         event = fExperiment.parseEvent(context);
         assertNull("Event timestamp", event);
         assertEquals("Context rank", NB_EVENTS, context.getRank());
-        
+
         // Negative ratio
         context = fExperiment.seekEvent(-0.5);
         assertEquals("Context rank", 0, context.getRank());
@@ -457,7 +458,7 @@ public class TmfExperimentTest extends TestCase {
     // ------------------------------------------------------------------------
 
     public void testSeekLocationOnCacheBoundary() throws Exception {
-        
+
         long cacheSize = fExperiment.getCacheSize();
 
         // Position trace at event rank 0
@@ -615,7 +616,7 @@ public class TmfExperimentTest extends TestCase {
 
     public void testProcessRequestForAllEvents() throws Exception {
 
-        final int nbEvents  = TmfEventRequest.ALL_DATA;
+        final int nbEvents  = TmfDataRequest.ALL_DATA;
         final int blockSize =  1;
         final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
         final long nbExpectedEvents = NB_EVENTS;
index b5d7198464a486a55ceab64c876b57e765a4b436..9c1d646a8b01110092d0af05d63140e6a0948038 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 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:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Adjusted for new Trace Model
@@ -28,6 +28,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
@@ -95,7 +96,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         super.setUp();
         setupTrace(DIRECTORY + File.separator + TEST_STREAM1, DIRECTORY + File.separator + TEST_STREAM2);
         if (fExperiment == null) {
-            fExperiment = new TmfExperimentStub<TmfEvent>(EXPERIMENT, (ITmfTrace<TmfEvent>[]) fTraces, BLOCK_SIZE);
+            fExperiment = new TmfExperimentStub<TmfEvent>(EXPERIMENT, fTraces, BLOCK_SIZE);
             fExperiment.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
         }
     }
@@ -306,7 +307,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // ------------------------------------------------------------------------
 
     public void testSeekLocationOnCacheBoundary() throws Exception {
-        
+
         long cacheSize = fExperiment.getCacheSize();
 
         // Position trace at event rank 0
@@ -464,7 +465,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
 
     public void testProcessRequestForAllEvents() throws Exception {
 
-        final int nbEvents  = TmfEventRequest.ALL_DATA;
+        final int nbEvents  = TmfDataRequest.ALL_DATA;
         final int blockSize =  1;
         final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
         final long nbExpectedEvents = NB_EVENTS;
index bb73b1bcab0e0a811ad140520f5c88b7674a079a..70c039dd939393b69d95a630f40b1765b0715254 100644 (file)
@@ -83,7 +83,7 @@ public class TmfTraceTest extends TestCase {
     // Helper functions
     // ------------------------------------------------------------------------
 
-    private TmfTraceStub setupTrace(final String path) {
+    private static TmfTraceStub setupTrace(final String path) {
         if (fTrace == null) {
             try {
                 final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
@@ -173,7 +173,6 @@ public class TmfTraceTest extends TestCase {
             fail("IOException");
         }
 
-        assertFalse ("Open trace", trace == null);
         assertEquals("getType",  TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
@@ -247,7 +246,6 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
     }
 
-    @SuppressWarnings({ "rawtypes", "unchecked" })
     public void testCopyConstructor() throws Exception {
         TmfTraceStub original = null;
         TmfTraceStub trace = null;
@@ -320,8 +318,7 @@ public class TmfTraceTest extends TestCase {
         } catch (Exception e) {
             fail("TmfTrace.initialize() - Exception thrown");
         }
-        
-        assertFalse ("Open trace", trace == null);
+
         assertEquals("getType", TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", path, trace.getPath());
@@ -349,8 +346,7 @@ public class TmfTraceTest extends TestCase {
         } catch (Exception e) {
             fail("TmfTrace.initialize() - Exception thrown");
         }
-        
-        assertFalse ("Open trace", trace == null);
+
         assertEquals("getType", TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", path, trace.getPath());
@@ -370,7 +366,6 @@ public class TmfTraceTest extends TestCase {
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
 
-        assertFalse ("Open trace", trace == null);
         assertNull  ("getType",  trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
@@ -1196,4 +1191,4 @@ public class TmfTraceTest extends TestCase {
         assertEquals("toString", expected, fTrace.toString());
     }
 
-}
\ No newline at end of file
+}
index 7daf2544add5fc6cc509077a9c8ab6e0e83da037..4679385239ff4bd17b924607903570b5faab19e1 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011 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:
  *   Bernd Hufmann - Initial API and implementation
  *******************************************************************************/
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.tmf.core.tests.uml2sd;
 import junit.framework.TestCase;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
@@ -23,7 +24,7 @@ import org.eclipse.linuxtools.tmf.core.uml2sd.TmfAsyncSequenceDiagramEvent;
 @SuppressWarnings("nls")
 public class TmfAsyncSequenceDiagramEventTest extends TestCase {
 
-    private final String fContext = TmfEventType.DEFAULT_CONTEXT_ID; 
+    private final String fContext = ITmfEventType.DEFAULT_CONTEXT_ID;
     private final String fTypeId  = "Some type";
     private final String fLabel0  = "label1";
     private final String fLabel1  = "label2";
@@ -40,7 +41,7 @@ public class TmfAsyncSequenceDiagramEventTest extends TestCase {
     private final TmfEventField fContent1;
     private final TmfEventField fContent2;
 
-   
+
     public TmfAsyncSequenceDiagramEventTest() {
         fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some content");
         fEvent1 = new TmfEvent(null, fTimestamp1, fSource, fType, fContent1, fReference);
@@ -48,19 +49,19 @@ public class TmfAsyncSequenceDiagramEventTest extends TestCase {
         fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some other content");
         fEvent2 = new TmfEvent(null, fTimestamp2, fSource, fType, fContent2, fReference);
     }
-    
-    @Override 
+
+    @Override
     public void setUp() throws Exception {
     }
-    
+
     @Override
     public void tearDown() throws Exception {
     }
-    
+
     public void testTmfAsyncSequenceDiagramEvent() {
         TmfAsyncSequenceDiagramEvent event = null;
-        
-        // Check for illegal arguments (i.e. null for the parameters) 
+
+        // Check for illegal arguments (i.e. null for the parameters)
         try {
             event = new TmfAsyncSequenceDiagramEvent(null, null, null, null, null);
             fail();
@@ -68,7 +69,7 @@ public class TmfAsyncSequenceDiagramEventTest extends TestCase {
             // success
             assertTrue("TmfAsyncSequenceDiagramEvent", e.getMessage().contains("startEvent=null"));
         }
-        
+
         try {
             event = new TmfAsyncSequenceDiagramEvent(fEvent1,  fEvent2, null, null, null);
             fail();
@@ -76,7 +77,7 @@ public class TmfAsyncSequenceDiagramEventTest extends TestCase {
             // success
             assertTrue("TmfAsyncSequenceDiagramEvent", e.getMessage().contains("sender=null"));
         }
-        
+
         try {
             event = new TmfAsyncSequenceDiagramEvent(fEvent1, fEvent2, null, null, null);
             fail();
@@ -92,7 +93,7 @@ public class TmfAsyncSequenceDiagramEventTest extends TestCase {
             // success
             assertTrue("TmfAsyncSequenceDiagramEvent", e.getMessage().contains("name=null"));
         }
-        
+
         try {
             event = new TmfAsyncSequenceDiagramEvent(fEvent1, null, "sender", "receiver", "signal");
             fail();
@@ -109,7 +110,7 @@ public class TmfAsyncSequenceDiagramEventTest extends TestCase {
             assertEquals("testTmfAsyncSequenceDiagramEvent", "sender", event.getSender());
             assertEquals("testTmfAsyncSequenceDiagramEvent", "receiver", event.getReceiver());
             assertEquals("testTmfAsyncSequenceDiagramEvent", "signal", event.getName());
-            
+
         } catch (IllegalArgumentException e) {
             fail();
         }
index 66b40c6b5f479cc6e7e24c00bc8cfb913d6228e1..2de6f23b719a012506e5d9db9dc4c2c4521f6f83 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011 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:
  *   Bernd Hufmann - Initial API and implementation
  *******************************************************************************/
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.tmf.core.tests.uml2sd;
 import junit.framework.TestCase;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
@@ -23,7 +24,7 @@ import org.eclipse.linuxtools.tmf.core.uml2sd.TmfSyncSequenceDiagramEvent;
 @SuppressWarnings("nls")
 public class TmfSyncSequenceDiagramEventTest extends TestCase {
 
-    private final String fContext = TmfEventType.DEFAULT_CONTEXT_ID; 
+    private final String fContext = ITmfEventType.DEFAULT_CONTEXT_ID;
     private final String fTypeId  = "Some type";
     private final String fLabel0  = "label1";
     private final String fLabel1  = "label2";
@@ -49,7 +50,7 @@ public class TmfSyncSequenceDiagramEventTest extends TestCase {
     @Override
     public void tearDown() throws Exception {
     }
-    
+
     public void testTmfSyncSequenceDiagramEvent() {
         TmfSyncSequenceDiagramEvent event = null;
         try {
@@ -59,7 +60,7 @@ public class TmfSyncSequenceDiagramEventTest extends TestCase {
             // success
             assertTrue("testTmfSyncSequenceDiagramEvent", e.getMessage().contains("startEvent=null"));
         }
-        
+
         try {
             event = new TmfSyncSequenceDiagramEvent(fEvent1, null, null, null);
             fail();
@@ -67,7 +68,7 @@ public class TmfSyncSequenceDiagramEventTest extends TestCase {
             // success
             assertTrue("testTmfSyncSequenceDiagramEvent", e.getMessage().contains("sender=null"));
         }
-        
+
         try {
             event = new TmfSyncSequenceDiagramEvent(fEvent1, "sender", null, null);
             fail();
@@ -83,7 +84,7 @@ public class TmfSyncSequenceDiagramEventTest extends TestCase {
             // success
             assertTrue("testTmfSyncSequenceDiagramEvent", e.getMessage().contains("name=null"));
         }
-        
+
         try {
             event = new TmfSyncSequenceDiagramEvent(fEvent1, "sender", "receiver", "signal");
             // success
@@ -91,7 +92,7 @@ public class TmfSyncSequenceDiagramEventTest extends TestCase {
             assertEquals("testTmfSyncSequenceDiagramEvent", "sender", event.getSender());
             assertEquals("testTmfSyncSequenceDiagramEvent", "receiver", event.getReceiver());
             assertEquals("testTmfSyncSequenceDiagramEvent", "signal", event.getName());
-            
+
         } catch (IllegalArgumentException e) {
             fail();
         }
index 0107bf547e2374cf55d2d50021db5fb93b9c2246..c6b83af8743eb45b4c90700a24e244f9be8fd0e0 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
index ab8c584d27c034fa9dfcb9bcb27132e481640da3..ec82597ba00ccc03cd0ac8267ab7f81cf7e3ac58 100644 (file)
@@ -1,19 +1,17 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.tests.stubs.trace;
 
-import java.io.FileNotFoundException;
-
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
index 93ade8d1451eb7f87929e791c803e8cdbfeac528..b9de89e51940227c5f6889569cc7e2c41b1217ed 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
  * Implement me. Please.
  * <p>
  */
-public class TmfExperimentStub<T extends ITmfEvent> extends TmfExperiment<TmfEvent> implements ITmfTrace<TmfEvent> {
+public class TmfExperimentStub<T extends ITmfEvent> extends TmfExperiment<TmfEvent> {
 
     public TmfExperimentStub(String name, ITmfTrace<TmfEvent>[] traces, int blockSize) {
         super(TmfEvent.class, name, traces, blockSize);
index 5e4d4d800b8046ff4bea5ab2b0a69fc5f1e0a684..5743b5b38f6ffe403ddd8ed2f6a1f8b056b261aa 100644 (file)
@@ -234,8 +234,6 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
                     }
                     final TmfContext context = new TmfContext(getCurrentLocation(), rank);
                     return context;
-                } else {
-                    
                 }
             } catch (final IOException e) {
                 e.printStackTrace();
@@ -316,7 +314,7 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
     }
 
     @Override
-    public void setNbEvents(final long nbEvents) {
+    public synchronized void setNbEvents(final long nbEvents) {
         super.setNbEvents(nbEvents);
     }
 
@@ -341,7 +339,7 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
     }
 
     @Override
-    public void dispose() {
+    public synchronized void dispose() {
         fLock.lock();
         try {
             if (fTrace != null) {
@@ -364,4 +362,4 @@ public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<
         return fileExists(path);
     }
 
-}
\ No newline at end of file
+}
index 2b48126055dfb2d53cf21e00975efcfd58e173d7..3dad637b1bf6cc2720a82f17bbcc28025d482d5e 100644 (file)
@@ -12,7 +12,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;\r
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;\r
 \r
-@SuppressWarnings("nls")\r
+@SuppressWarnings({"nls", "javadoc"})\r
 public class Tracer {\r
 \r
     private static String pluginID = Activator.PLUGIN_ID;\r
index ba35f5ac77d635b24c7ff51e237ae6b0c9f0226e..28b83d58a511f738f988562576cb78315126fd91 100644 (file)
@@ -43,9 +43,9 @@ public class TmfProviderManager {
 
        /**
         * Registers [provider] as a provider of [eventType]
-        * 
-        * @param eventType
-        * @param provider
+        *
+        * @param eventType The event type
+        * @param provider The data provider
         */
        public static <T extends ITmfEvent> void register(Class<T> eventType, TmfDataProvider<? extends ITmfEvent> provider) {
                if (fProviders.get(eventType) == null)
@@ -55,9 +55,9 @@ public class TmfProviderManager {
 
        /**
         * Re-registers [provider] as a provider of [eventType]
-        * 
-        * @param eventType
-        * @param provider
+        *
+        * @param eventType The event type
+        * @param provider The data provider
         */
        public static <T extends ITmfEvent> void deregister(Class<T> eventType, TmfDataProvider<? extends ITmfEvent> provider) {
                List<TmfDataProvider<? extends ITmfEvent>> list = fProviders.get(eventType);
@@ -70,8 +70,8 @@ public class TmfProviderManager {
 
        /**
         * Returns the list of components that provide [eventType]
-        * 
-        * @param eventType
+        *
+        * @param eventType The event type
         * @return the list of components that provide [eventType]
         */
        @SuppressWarnings("unchecked")
@@ -85,9 +85,9 @@ public class TmfProviderManager {
 
        /**
         * Returns the list of components of type [providerType] that provide [eventType]
-        * 
-        * @param eventType
-        * @param providerType
+        *
+        * @param eventType The event type
+        * @param providerType The data provider
      * @return the list of components of type [providerType] that provide [eventType]
         */
        @SuppressWarnings("unchecked")
index dd430b66f7c52568d8c6c6b26bd798b37353a5a1..9453bf23edcc7fee71180347c64f7abf8f0dc345 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -16,23 +16,35 @@ import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
 
 /**
  * Utility class to add an execution class to a simple Java thread
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
 public class TmfThread extends Thread {
 
-       private final ExecutionType fExecType;
-       
-       public TmfThread(ExecutionType execType) {
-               fExecType = execType;
-       }
-       
-       public ExecutionType getExecType() {
-               return fExecType;
-       }
-
-       public void cancel() {
-       }
+    private final ExecutionType fExecType;
+
+    /**
+     * Standard constructor
+     *
+     * @param execType
+     *            The data request's ExecutionType
+     */
+    public TmfThread(ExecutionType execType) {
+        fExecType = execType;
+    }
+
+    /**
+     * @return The Execution type
+     */
+    public ExecutionType getExecType() {
+        return fExecType;
+    }
+
+    /**
+     * Cancel this request
+     */
+    public void cancel() {
+    }
 
 }
index c946cc275d71a0b87973e25ccf534319a8941432..4cb93be3f8ace69676bbfea68518fc4cd3f21dc9 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 
 /**
  * The TMF coalesced data request
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -42,7 +42,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request all the events of a given type (high priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      */
     public TmfCoalescedDataRequest(Class<T> dataType) {
@@ -52,7 +52,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request all the events of a given type (given priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param priority the requested execution priority
      */
@@ -63,7 +63,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request all the events of a given type from the given index (high priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param index the index of the first event to retrieve
      */
@@ -74,7 +74,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request all the events of a given type from the given index (given priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param index the index of the first event to retrieve
      * @param priority the requested execution priority
@@ -86,7 +86,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request 'n' events of a given type from the given index (high priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param index the index of the first event to retrieve
      * @param nbRequested the number of events requested
@@ -98,7 +98,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request 'n' events of a given type from the given index (given priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param index the index of the first event to retrieve
      * @param nbRequested the number of events requested
@@ -111,7 +111,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request 'n' events of a given type from the given index (high priority).
      * Events are returned in blocks of the given size.
-     * 
+     *
      * @param dataType the requested data type
      * @param index the index of the first event to retrieve
      * @param nbRequested the number of events requested
@@ -124,7 +124,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     /**
      * Request 'n' events of a given type from the given index (given priority).
      * Events are returned in blocks of the given size.
-     * 
+     *
      * @param dataType the requested data type
      * @param index the index of the first event to retrieve
      * @param nbRequested the number of events requested
@@ -139,17 +139,29 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     // Management
     // ------------------------------------------------------------------------
 
-       public void addRequest(ITmfDataRequest<T> request) {
-               fRequests.add(request);
+    /**
+     * Add a request to this one.
+     *
+     * @param request The request to add
+     */
+    public void addRequest(ITmfDataRequest<T> request) {
+        fRequests.add(request);
         merge(request);
-       }
+    }
 
-       public boolean isCompatible(ITmfDataRequest<T> request) {
-               if (request.getExecType() == getExecType()) {
-               return overlaps(request);
-               }
-               return false;
-       }
+    /**
+     * Check if a request is compatible with the current coalesced one
+     *
+     * @param request
+     *            The request to verify
+     * @return If the request is compatible, true or false
+     */
+    public boolean isCompatible(ITmfDataRequest<T> request) {
+        if (request.getExecType() == getExecType()) {
+            return overlaps(request);
+        }
+        return false;
+    }
 
     private boolean overlaps(ITmfDataRequest<T> request) {
         long start = request.getIndex();
@@ -163,7 +175,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     private void merge(ITmfDataRequest<T> request) {
         long start = request.getIndex();
         long end = Math.min(start + request.getNbRequested(), TmfDataRequest.ALL_DATA);
-        
+
         if (start < fIndex) {
             if (fNbRequested != TmfDataRequest.ALL_DATA) {
                 fNbRequested += (fIndex - start);
@@ -179,11 +191,16 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
         }
     }
 
+       /**
+        * @return The list of IDs of the sub-requests
+        */
        @SuppressWarnings("nls")
     public String getSubRequestIds() {
            StringBuffer result = new StringBuffer("[");
            for (int i = 0; i < fRequests.size(); i++) {
-               if (i != 0) result.append(", ");
+               if (i != 0) {
+                result.append(", ");
+            }
                result.append(fRequests.get(i).getRequestId());
            }
            result.append("]");
@@ -225,7 +242,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
         }
         super.start();
     }
-    
+
        @Override
     public void done() {
        for (ITmfDataRequest<T> request : fRequests) {
@@ -253,9 +270,9 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
        }
        super.cancel();
     }
-    
+
     @Override
-    public boolean isCompleted() {
+    public synchronized boolean isCompleted() {
         // Firstly, check if coalescing request is completed
         if (super.isCompleted()) {
             return true;
@@ -263,7 +280,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
 
         // Secondly, check if all sub-requests are finished
         if (fRequests.size() > 0) {
-            // If all sub requests are completed the coalesced request is 
+            // If all sub requests are completed the coalesced request is
             // treated as completed, too.
             for (ITmfDataRequest<T> request : fRequests) {
                 if (!request.isCompleted()) {
@@ -278,7 +295,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     }
 
     @Override
-    public boolean isCancelled() {
+    public synchronized boolean isCancelled() {
         // Firstly, check if coalescing request is canceled
         if (super.isCancelled()) {
             return true;
@@ -286,7 +303,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
 
         // Secondly, check if all sub-requests are canceled
         if (fRequests.size() > 0) {
-            // If all sub requests are canceled the coalesced request is 
+            // If all sub requests are canceled the coalesced request is
             // treated as completed, too.
             for (ITmfDataRequest<T> request : fRequests) {
                 if (!request.isCancelled()) {
@@ -301,7 +318,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
 
     }
 
-    
+
     // ------------------------------------------------------------------------
     // Object
     // ------------------------------------------------------------------------
@@ -327,7 +344,7 @@ public class TmfCoalescedDataRequest<T extends ITmfEvent> extends TmfDataRequest
     @Override
     @SuppressWarnings("nls")
     public String toString() {
-               return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName() 
+               return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName()
                        + "," + getIndex() + "," + getNbRequested() + "," + getBlockSize() + ")]";
     }
 }
index 1cb9c33fceb215d2825ab2515af9566be441afc4..42fde555fa6a46bafb16eb0bb6860c170afe1761 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 
 /**
  * The TMF coalesced event request
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -42,7 +42,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request all the events of a given type (high priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      */
     public TmfCoalescedEventRequest(Class<T> dataType) {
@@ -52,7 +52,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request all the events of a given type (given priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param priority the requested execution priority
      */
@@ -63,7 +63,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request all the events of a given type for the given time range (high priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      */
@@ -74,7 +74,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request all the events of a given type for the given time range (given priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      * @param priority the requested execution priority
@@ -86,7 +86,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request 'n' events of a given type from the given time range (high priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      * @param nbRequested the number of events requested
@@ -98,7 +98,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request 'n' events of a given type for the given time range (given priority)
      * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      * @param nbRequested the number of events requested
@@ -111,7 +111,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request 'n' events of a given type for the given time range (high priority).
      * Events are returned in blocks of the given size.
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      * @param nbRequested the number of events requested
@@ -124,7 +124,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request 'n' events of a given type for the given time range (given priority).
      * Events are returned in blocks of the given size.
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      * @param nbRequested the number of events requested
@@ -138,7 +138,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     /**
      * Request 'n' events of a given type for the given time range (given priority).
      * Events are returned in blocks of the given size.
-     * 
+     *
      * @param dataType the requested data type
      * @param range the time range of the requested events
      * @param index the index of the first event to retrieve
@@ -154,9 +154,9 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
             String type = getClass().getName();
             type = type.substring(type.lastIndexOf('.') + 1);
             @SuppressWarnings("nls")
-            String message = "CREATED " 
-                    + (getExecType() == ITmfDataRequest.ExecutionType.BACKGROUND ? "(BG)" : "(FG)") 
-                    + " Type=" + type + " Index=" + getIndex() + " NbReq=" + getNbRequested() 
+            String message = "CREATED "
+                    + (getExecType() == ITmfDataRequest.ExecutionType.BACKGROUND ? "(BG)" : "(FG)")
+                    + " Type=" + type + " Index=" + getIndex() + " NbReq=" + getNbRequested()
                     + " Range=" + getRange()
                     + " DataType=" + getDataType().getSimpleName();
             Tracer.traceRequest(this, message);
@@ -186,14 +186,14 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
        }
 
     private boolean overlaps(ITmfEventRequest<T> request) {
-        ITmfTimestamp startTime = ((ITmfEventRequest<T>) request).getRange().getStartTime();
-        ITmfTimestamp endTime   = ((ITmfEventRequest<T>) request).getRange().getEndTime();
+        ITmfTimestamp startTime = request.getRange().getStartTime();
+        ITmfTimestamp endTime   = request.getRange().getEndTime();
         return (startTime.compareTo(endTime) <= 0) && (fRange.getStartTime().compareTo(fRange.getEndTime()) <= 0);
     }
 
     private void merge(ITmfEventRequest<T> request) {
-        ITmfTimestamp startTime = ((ITmfEventRequest<T>) request).getRange().getStartTime();
-        ITmfTimestamp endTime   = ((ITmfEventRequest<T>) request).getRange().getEndTime();
+        ITmfTimestamp startTime = request.getRange().getStartTime();
+        ITmfTimestamp endTime   = request.getRange().getEndTime();
         if (!fRange.contains(startTime) && fRange.getStartTime().compareTo(startTime) > 0) {
             fRange = new TmfTimeRange(startTime, fRange.getEndTime());
         }
@@ -244,12 +244,12 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
        public TmfTimeRange getRange() {
                return fRange;
        }
-       
+
        @Override
        public void setStartIndex(int index) {
                setIndex(index);
        }
-       
+
     // ------------------------------------------------------------------------
     // Object
     // ------------------------------------------------------------------------
@@ -278,7 +278,7 @@ public class TmfCoalescedEventRequest<T extends ITmfEvent> extends TmfCoalescedD
     @Override
     @SuppressWarnings("nls")
     public String toString() {
-               return "[TmfCoalescedEventRequest(" + getRequestId() + "," + getDataType().getSimpleName() 
+               return "[TmfCoalescedEventRequest(" + getRequestId() + "," + getDataType().getSimpleName()
                        + "," + getRange() + "," + getIndex() + "," + getNbRequested() + "," + getBlockSize() + ")]";
     }
 
index 6bbfd5c496b14751573f5db0ace0636accdaad31..a3ab5d8227feab1c8711cda25437efab21273f1d 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -24,7 +24,7 @@ import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
 
 /**
  * A simple, straightforward request executor.
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
@@ -32,32 +32,46 @@ public class TmfRequestExecutor implements Executor {
 
        private final ExecutorService fExecutor;
        private final String fExecutorName;
-       private final PriorityBlockingQueue<TmfThread> fRequestQueue = new PriorityBlockingQueue<TmfThread>(100, new Comparator<TmfThread>() {
-               @Override
-               public int compare(TmfThread o1, TmfThread o2) {
-                       if (o1.getExecType() == o2.getExecType())
-                               return 0;
-                       if (o1.getExecType() == ExecutionType.BACKGROUND)
-                               return 1;
-                       return -1;
-               }
-       });
-       private TmfThread fCurrentRequest;
-       
-       // ------------------------------------------------------------------------
-       // Constructors
-       // ------------------------------------------------------------------------
-       
-       public TmfRequestExecutor() {
-               this(Executors.newSingleThreadExecutor());
-       }
+    private final PriorityBlockingQueue<TmfThread> fRequestQueue = new PriorityBlockingQueue<TmfThread>(
+            100, new Comparator<TmfThread>() {
+                @Override
+                public int compare(TmfThread o1, TmfThread o2) {
+                    if (o1.getExecType() == o2.getExecType()) {
+                        return 0;
+                    }
+                    if (o1.getExecType() == ExecutionType.BACKGROUND) {
+                        return 1;
+                    }
+                    return -1;
+                }
+            });
+    private TmfThread fCurrentRequest;
 
-       public TmfRequestExecutor(ExecutorService executor) {
-               fExecutor = executor;
-               String canonicalName = fExecutor.getClass().getCanonicalName();
-               fExecutorName = canonicalName.substring(canonicalName.lastIndexOf('.') + 1);
-               if (Tracer.isComponentTraced()) Tracer.trace(fExecutor + " created"); //$NON-NLS-1$
-       }
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Default constructor
+     */
+    public TmfRequestExecutor() {
+        this(Executors.newSingleThreadExecutor());
+    }
+
+    /**
+     * Standard constructor
+     *
+     * @param executor The executor service to use
+     */
+    public TmfRequestExecutor(ExecutorService executor) {
+        fExecutor = executor;
+        String canonicalName = fExecutor.getClass().getCanonicalName();
+        fExecutorName = canonicalName.substring(canonicalName.lastIndexOf('.') + 1);
+        if (Tracer.isComponentTraced())
+        {
+            Tracer.trace(fExecutor + " created"); //$NON-NLS-1$
+        }
+    }
 
        /**
         * @return the number of pending requests
@@ -65,21 +79,21 @@ public class TmfRequestExecutor implements Executor {
        public synchronized int getNbPendingRequests() {
                return fRequestQueue.size();
        }
-       
+
        /**
         * @return the shutdown state (i.e. if it is accepting new requests)
         */
        public synchronized boolean isShutdown() {
                return fExecutor.isShutdown();
        }
-       
+
        /**
         * @return the termination state
         */
        public synchronized boolean isTerminated() {
                return fExecutor.isTerminated();
        }
-       
+
        /**
         * Stops the executor
         */
@@ -87,19 +101,22 @@ public class TmfRequestExecutor implements Executor {
            if (fCurrentRequest != null) {
                fCurrentRequest.cancel();
            }
-           
+
            while ((fCurrentRequest = fRequestQueue.poll()) != null) {
                fCurrentRequest.cancel();
            }
 
                fExecutor.shutdown();
-               if (Tracer.isComponentTraced()) Tracer.trace(fExecutor + " terminated"); //$NON-NLS-1$
+               if (Tracer.isComponentTraced())
+         {
+            Tracer.trace(fExecutor + " terminated"); //$NON-NLS-1$
+        }
        }
-       
+
        // ------------------------------------------------------------------------
        // Operations
        // ------------------------------------------------------------------------
-       
+
        /* (non-Javadoc)
         * @see java.util.concurrent.Executor#execute(java.lang.Runnable)
         */
@@ -129,8 +146,9 @@ public class TmfRequestExecutor implements Executor {
         */
        protected synchronized void scheduleNext() {
                if ((fCurrentRequest = fRequestQueue.poll()) != null) {
-                       if (!isShutdown())
-                               fExecutor.execute(fCurrentRequest);
+                       if (!isShutdown()) {
+                fExecutor.execute(fCurrentRequest);
+            }
                }
        }
 
index dfe716fedd891f487693185f75616efba5985bdf..be7377efb06e96cf33b8227f055fc69c28c3beb8 100644 (file)
@@ -32,7 +32,7 @@ import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
  * The last trace refers to the trace from which the last event was "consumed"
  * at the experiment level.
  */
-public class TmfExperimentContext extends TmfContext implements Cloneable {
+public class TmfExperimentContext extends TmfContext {
 
     // ------------------------------------------------------------------------
     // Constants
@@ -65,15 +65,16 @@ public class TmfExperimentContext extends TmfContext implements Cloneable {
         final ITmfLocation<?>[] locations = new ITmfLocation[fContexts.length];
 
         setLocation(new TmfExperimentLocation(new TmfLocationArray(locations.clone())));
-        
+
         final long[] ranks = new long[fContexts.length];
         long rank = 0;
-        for (int i = 0; i < fContexts.length; i++)
+        for (int i = 0; i < fContexts.length; i++) {
             if (contexts[i] != null) {
                 locations[i] = contexts[i].getLocation();
                 ranks[i] = contexts[i].getRank();
                 rank += contexts[i].getRank();
             }
+        }
 
 //        setLocation(new TmfExperimentLocation(new TmfLocationArray(locations)));
         setRank(rank);
@@ -86,8 +87,9 @@ public class TmfExperimentContext extends TmfContext implements Cloneable {
     public TmfExperimentContext(final TmfExperimentContext other) {
         this(other.cloneContexts());
         fEvents = other.fEvents;
-        if (other.getLocation() != null)
+        if (other.getLocation() != null) {
             setLocation(other.getLocation().clone());
+        }
         setRank(other.getRank());
         setLastTrace(other.fLastTraceRead);
     }
@@ -107,15 +109,17 @@ public class TmfExperimentContext extends TmfContext implements Cloneable {
 
     private ITmfContext[] cloneContexts() {
         final ITmfContext[] contexts = new ITmfContext[fContexts.length];
-        for (int i = 0; i < fContexts.length; i++)
+        for (int i = 0; i < fContexts.length; i++) {
             contexts[i] = (fContexts[i] != null) ? fContexts[i].clone() : null;
+        }
         return contexts;
     }
 
     private ITmfEvent[] cloneEvents() {
         final ITmfEvent[] events = new ITmfEvent[fEvents.length];
-        for (int i = 0; i < fEvents.length; i++)
+        for (int i = 0; i < fEvents.length; i++) {
             events[i] = (fEvents[i] != null) ? fEvents[i].clone() : null;
+        }
         return events;
     }
 
@@ -154,12 +158,15 @@ public class TmfExperimentContext extends TmfContext implements Cloneable {
 
     @Override
     public boolean equals(final Object other) {
-        if (this == other)
+        if (this == other) {
             return true;
-        if (!super.equals(other))
+        }
+        if (!super.equals(other)) {
             return false;
-        if (!(other instanceof TmfExperimentContext))
+        }
+        if (!(other instanceof TmfExperimentContext)) {
             return false;
+        }
         final TmfExperimentContext o = (TmfExperimentContext) other;
         boolean isEqual = true;
         int i = 0;
index 22e4357a9b62e8f64416269ef65a4e122f2d53cb..1b11ec1b96d246b9880aa30b814b50de02a3eb32 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 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:
  * Francois Chouinard - Initial API and implementation
  * Francois Chouinard - Updated as per TMF Trace Model 1.0
@@ -25,13 +25,13 @@ import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
  * <p>
  * It is the responsibility of the user the individual trace locations are valid
  * and that they are matched to the correct trace.
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
- * 
+ *
  * @see TmfLocationArray
  */
-public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> implements Cloneable {
+public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> {
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -39,7 +39,7 @@ public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> impleme
 
     /**
      * The standard constructor
-     * 
+     *
      * @param locations the set of trace locations
      */
     public TmfExperimentLocation(TmfLocationArray locations) {
@@ -48,7 +48,7 @@ public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> impleme
 
     /**
      * The copy constructor
-     * 
+     *
      * @param location the other experiment location
      */
     public TmfExperimentLocation(TmfExperimentLocation location) {
@@ -65,7 +65,7 @@ public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> impleme
     @Override
     public TmfExperimentLocation clone() {
 //        super.clone(); // To keep FindBugs happy
-        TmfLocationArray array = (TmfLocationArray) getLocation();
+        TmfLocationArray array = getLocation();
         TmfLocationArray clones = array.clone();
         return new TmfExperimentLocation(clones);
     }
@@ -81,7 +81,7 @@ public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> impleme
     @SuppressWarnings("nls")
     public String toString() {
         StringBuilder result = new StringBuilder("[TmfExperimentLocation");
-        ITmfLocation<? extends Comparable<?>>[] locations = ((TmfLocationArray) getLocation()).getLocations();
+        ITmfLocation<? extends Comparable<?>>[] locations = getLocation().getLocations();
         for (ITmfLocation<?> location : locations) {
             result.append("[" + location + "]");
         }
index 06a324528abf723604a632fe8a92eefb7e030889..49445d8eb05d11eb57cd231055f1f8da8fa69463 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011, 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 - Initial API and implementation
  * Francois Chouinard - Put in shape for 1.0
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 /**
  * A convenience class to store trace location arrays. The main purpose is to
  * provide a Comparable implementation for TmfExperimentLocation.
- * 
+ *
  * @version 1.0
  * @author Patrick Tasse
  */
@@ -30,7 +30,7 @@ public class TmfLocationArray implements Comparable<TmfLocationArray>, Cloneable
     // Attributes
     // ------------------------------------------------------------------------
 
-    private ITmfLocation<? extends Comparable<?>>[] fLocations;
+    private final ITmfLocation<? extends Comparable<?>>[] fLocations;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -38,7 +38,7 @@ public class TmfLocationArray implements Comparable<TmfLocationArray>, Cloneable
 
     /**
      * The standard constructor
-     * 
+     *
      * @param locations the locations
      */
     public TmfLocationArray(ITmfLocation<? extends Comparable<?>>[] locations) {
@@ -51,7 +51,7 @@ public class TmfLocationArray implements Comparable<TmfLocationArray>, Cloneable
 
     /**
      * The standard constructor
-     * 
+     *
      * @param locations the locations
      */
     public ITmfLocation<? extends Comparable<?>>[] getLocations() {
@@ -67,7 +67,7 @@ public class TmfLocationArray implements Comparable<TmfLocationArray>, Cloneable
      */
     @Override
     public TmfLocationArray clone() {
-        ITmfLocation<? extends Comparable<?>>[] clones = (ITmfLocation<? extends Comparable<?>>[]) new ITmfLocation<?>[fLocations.length];
+        ITmfLocation<? extends Comparable<?>>[] clones = new ITmfLocation<?>[fLocations.length];
         for (int i = 0; i < fLocations.length; i++) {
             ITmfLocation<?> location = fLocations[i];
             clones[i] = (location != null) ? location.clone() : null;
index b14dec69ab14fb6edfb017939882e9593a8b6ce8..8c8c9e80f66aa396958c3e01e520e9b741b258fc 100644 (file)
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 
 /**
  * The CTF adapter for the TMF timestamp
- * 
+ *
  * @version 1.0
  * @author Matthew khouzam
  */
@@ -125,6 +125,8 @@ public class CtfTmfTimestamp extends TmfTimestamp {
         case SECONDS:{
             return secondsToString();
         }
+        default:
+            break;
         }
         return super.toString();
     }
index 32980e2595c302264a118f9a79ea48c2485c43d6..ff9eb25ee39a6c5c2fafaf541f64990abe55bccd 100644 (file)
@@ -264,7 +264,6 @@ public class CtfTmfTrace extends TmfTrace<CtfTmfEvent> implements ITmfEventParse
      * sub-classes.
      * @throws TmfTraceException
      */
-    @SuppressWarnings({ "static-method" })
     protected void buildStateSystem() throws TmfTraceException {
         /*
          * Nothing is done in the basic implementation, please specify
index c5d8299fd2be90a7ec5808f37ac2b489b22aafb7..dcab9a58256f41eefb2ed39845797ff30f23c2a9 100644 (file)
@@ -13,8 +13,8 @@
 
 package org.eclipse.linuxtools.tmf.core.event;
 
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
 
 /**
  * A basic implementation of ITmfEvent.
@@ -54,7 +54,7 @@ public class TmfEvent implements ITmfEvent, Cloneable {
      * event rank is set to TmfContext.UNKNOWN_RANK.
      */
     public TmfEvent() {
-        this(null, TmfContext.UNKNOWN_RANK, null, null, null, null, null);
+        this(null, ITmfContext.UNKNOWN_RANK, null, null, null, null, null);
     }
 
     /**
@@ -71,7 +71,7 @@ public class TmfEvent implements ITmfEvent, Cloneable {
     public TmfEvent(final ITmfTrace<? extends ITmfEvent> trace, final ITmfTimestamp timestamp, final String source,
             final ITmfEventType type, final ITmfEventField content, final String reference)
     {
-        this(trace, TmfContext.UNKNOWN_RANK, timestamp, source, type, content, reference);
+        this(trace, ITmfContext.UNKNOWN_RANK, timestamp, source, type, content, reference);
     }
 
     /**
index 6ec7f3c428b2a1a04383dc9379e5e38cf6fef04a..99ffd37b437d31eeee4471df885ea5f07eacdf0d 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -14,11 +14,11 @@ package org.eclipse.linuxtools.tmf.core.event;
 
 /**
  * A simplified timestamp where scale and precision are set to 0.
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  */
-public class TmfSimpleTimestamp extends TmfTimestamp implements Cloneable {
+public class TmfSimpleTimestamp extends TmfTimestamp {
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -42,7 +42,7 @@ public class TmfSimpleTimestamp extends TmfTimestamp implements Cloneable {
 
     /**
      * Copy constructor
-     * 
+     *
      * @param timestamp the timestamp to copy
      */
     public TmfSimpleTimestamp(final ITmfTimestamp timestamp) {
index c8a68c47cd15cf039eb8befb3c0d9c622a8a7bba..ff0d95dad7712a2ce7c3e0eda1e69cab05fb1f0a 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -23,7 +23,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 \r
 /**\r
  * Filter node for the comparison operation\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Patrick Tasse\r
  */\r
@@ -35,7 +35,7 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
        public static final String RESULT_ATTR = "result"; //$NON-NLS-1$\r
        public static final String TYPE_ATTR = "type"; //$NON-NLS-1$\r
        public static final String VALUE_ATTR = "value"; //$NON-NLS-1$\r
-       \r
+\r
        /**\r
         * Supported comparison types\r
         */\r
@@ -44,7 +44,7 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
                ALPHA,\r
                TIMESTAMP\r
        }\r
-       \r
+\r
        private boolean fNot = false;\r
        private String fField;\r
        private int fResult;\r
@@ -52,7 +52,7 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
        private String fValue;\r
        private Number fValueNumber;\r
        private TmfTimestamp fValueTimestamp;\r
-       \r
+\r
        public TmfFilterCompareNode(ITmfFilterTreeNode parent) {\r
                super(parent);\r
        }\r
@@ -60,11 +60,11 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
        public boolean isNot() {\r
                return fNot;\r
        }\r
-       \r
+\r
        public void setNot(boolean not) {\r
                this.fNot = not;\r
        }\r
-       \r
+\r
        public String getField() {\r
                return fField;\r
        }\r
@@ -76,11 +76,11 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
        public int getResult() {\r
                return fResult;\r
        }\r
-       \r
+\r
        public void setResult(int result) {\r
                this.fResult = result;\r
        }\r
-       \r
+\r
        public Type getType() {\r
                return fType;\r
        }\r
@@ -93,7 +93,7 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
        public String getValue() {\r
                return fValue;\r
        }\r
-       \r
+\r
        public void setValue(String value) {\r
                this.fValue = value;\r
                fValueNumber = null;\r
@@ -113,7 +113,7 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
                        }\r
                }\r
        }\r
-       \r
+\r
        @Override\r
        public String getNodeName() {\r
                return NODE_NAME;\r
@@ -130,34 +130,35 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode {
                 if (value instanceof Number) {\r
                     Double valueDouble = ((Number) value).doubleValue();\r
                     return (valueDouble.compareTo(fValueNumber.doubleValue()) == fResult) ^ fNot;\r
-                } else {\r
-                    try {\r
-                        Double valueDouble = NumberFormat.getInstance().parse(value.toString())\r
-                                        .doubleValue();\r
-                        return (valueDouble.compareTo(fValueNumber.doubleValue()) == fResult)\r
-                                        ^ fNot;\r
-                    } catch (ParseException e) {\r
-                    }\r
+                }\r
+                try {\r
+                    Double valueDouble = NumberFormat.getInstance().parse(value.toString())\r
+                                    .doubleValue();\r
+                    return (valueDouble.compareTo(fValueNumber.doubleValue()) == fResult)\r
+                                    ^ fNot;\r
+                } catch (ParseException e) {\r
                 }\r
             }\r
         } else if (fType == Type.ALPHA) {\r
             String valueString = value.toString();\r
             int comp = valueString.compareTo(fValue.toString());\r
-            if (comp < -1) comp = -1;\r
-            else if (comp > 1) comp = 1;\r
+            if (comp < -1) {\r
+                comp = -1;\r
+            } else if (comp > 1) {\r
+                comp = 1;\r
+            }\r
             return (comp == fResult) ^ fNot;\r
         } else if (fType == Type.TIMESTAMP) {\r
             if (fValueTimestamp != null) {\r
                 if (value instanceof TmfTimestamp) {\r
                     TmfTimestamp valueTimestamp = (TmfTimestamp) value;\r
                     return (valueTimestamp.compareTo(fValueTimestamp, false) == fResult) ^ fNot;\r
-                } else {\r
-                    try {\r
-                        TmfTimestamp valueTimestamp = new TmfTimestamp((long) (1E9 * NumberFormat\r
-                                        .getInstance().parse(value.toString()).doubleValue()));\r
-                        return (valueTimestamp.compareTo(fValueTimestamp, false) == fResult) ^ fNot;\r
-                    } catch (ParseException e) {\r
-                    }\r
+                }\r
+                try {\r
+                    TmfTimestamp valueTimestamp = new TmfTimestamp((long) (1E9 * NumberFormat\r
+                                    .getInstance().parse(value.toString()).doubleValue()));\r
+                    return (valueTimestamp.compareTo(fValueTimestamp, false) == fResult) ^ fNot;\r
+                } catch (ParseException e) {\r
                 }\r
             }\r
         }\r
index e57c93ce1a75901e1c3ff7301946cc6ea2cf4268..476999e90403d582a89aaefb5792db80a7ff0bf7 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -19,7 +19,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 \r
 /**\r
  * Filter node for the 'contains' operation\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Patrick Tasse\r
  */\r
@@ -30,13 +30,13 @@ public class TmfFilterContainsNode extends TmfFilterTreeNode {
        public static final String FIELD_ATTR = "field"; //$NON-NLS-1$\r
        public static final String VALUE_ATTR = "value"; //$NON-NLS-1$\r
        public static final String IGNORECASE_ATTR = "ignorecase"; //$NON-NLS-1$\r
-       \r
+\r
        private boolean fNot = false;\r
        private String fField;\r
        private String fValue;\r
        private String fValueUpperCase;\r
        private boolean fIgnoreCase = false;\r
-       \r
+\r
        public TmfFilterContainsNode(ITmfFilterTreeNode parent) {\r
                super(parent);\r
        }\r
@@ -44,11 +44,11 @@ public class TmfFilterContainsNode extends TmfFilterTreeNode {
        public boolean isNot() {\r
                return fNot;\r
        }\r
-       \r
+\r
        public void setNot(boolean not) {\r
                this.fNot = not;\r
        }\r
-       \r
+\r
        public String getField() {\r
                return fField;\r
        }\r
@@ -69,11 +69,11 @@ public class TmfFilterContainsNode extends TmfFilterTreeNode {
        public boolean isIgnoreCase() {\r
                return fIgnoreCase;\r
        }\r
-       \r
+\r
        public void setIgnoreCase(boolean ignoreCase) {\r
                this.fIgnoreCase = ignoreCase;\r
        }\r
-       \r
+\r
        @Override\r
        public String getNodeName() {\r
                return NODE_NAME;\r
@@ -88,9 +88,8 @@ public class TmfFilterContainsNode extends TmfFilterTreeNode {
         String valueString = value.toString();\r
         if (fIgnoreCase) {\r
             return valueString.toUpperCase().contains(fValueUpperCase) ^ fNot;\r
-        } else {\r
-            return valueString.contains(fValue) ^ fNot;\r
         }\r
+        return valueString.contains(fValue) ^ fNot;\r
        }\r
 \r
        @Override\r
index 37e5826f48982f75b20d8b6b4b727dbfc85ab241..2a85da28d7fd4ff983e32b2991dec02803b824cb 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 \r
 /**\r
  * Filter node for the '==' operation\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Patrick Tasse\r
  */\r
@@ -31,12 +31,12 @@ public class TmfFilterEqualsNode extends TmfFilterTreeNode {
        public static final String FIELD_ATTR = "field"; //$NON-NLS-1$\r
        public static final String VALUE_ATTR = "value"; //$NON-NLS-1$\r
        public static final String IGNORECASE_ATTR = "ignorecase"; //$NON-NLS-1$\r
-       \r
+\r
        private boolean fNot = false;\r
        private String fField;\r
        private String fValue;\r
        private boolean fIgnoreCase = false;\r
-       \r
+\r
        public TmfFilterEqualsNode(ITmfFilterTreeNode parent) {\r
                super(parent);\r
        }\r
@@ -44,11 +44,11 @@ public class TmfFilterEqualsNode extends TmfFilterTreeNode {
        public boolean isNot() {\r
                return fNot;\r
        }\r
-       \r
+\r
        public void setNot(boolean not) {\r
                this.fNot = not;\r
        }\r
-       \r
+\r
        public String getField() {\r
                return fField;\r
        }\r
@@ -68,11 +68,11 @@ public class TmfFilterEqualsNode extends TmfFilterTreeNode {
        public boolean isIgnoreCase() {\r
                return fIgnoreCase;\r
        }\r
-       \r
+\r
        public void setIgnoreCase(boolean ignoreCase) {\r
                this.fIgnoreCase = ignoreCase;\r
        }\r
-       \r
+\r
        @Override\r
        public String getNodeName() {\r
                return NODE_NAME;\r
@@ -90,9 +90,8 @@ public class TmfFilterEqualsNode extends TmfFilterTreeNode {
         }\r
         if (fIgnoreCase) {\r
             return valueString.equalsIgnoreCase(fValue) ^ fNot;\r
-        } else {\r
-            return valueString.equals(fValue) ^ fNot;\r
         }\r
+        return valueString.equals(fValue) ^ fNot;\r
        }\r
 \r
        @Override\r
index 9694665a213328744da52e2975e20590a28aaacd..8086ea1a4583049a7b249928ae32c8c09e0743ff 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
@@ -19,7 +19,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 \r
 /**\r
  * Filter node for an event\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Patrick Tasse\r
  */\r
@@ -28,10 +28,10 @@ public class TmfFilterEventTypeNode extends TmfFilterTreeNode {
        public static final String NODE_NAME = "EVENTTYPE"; //$NON-NLS-1$\r
        public static final String TYPE_ATTR = "type"; //$NON-NLS-1$\r
        public static final String NAME_ATTR = "name"; //$NON-NLS-1$\r
-       \r
+\r
        private String fType;\r
        private String fName;\r
-       \r
+\r
        public TmfFilterEventTypeNode(ITmfFilterTreeNode parent) {\r
                super(parent);\r
        }\r
@@ -88,9 +88,8 @@ public class TmfFilterEventTypeNode extends TmfFilterTreeNode {
        public List<String> getValidChildren() {\r
                if (getChildrenCount() == 0) {\r
                        return super.getValidChildren();\r
-               } else {\r
-                       return new ArrayList<String>(0); // only one child allowed\r
                }\r
+        return new ArrayList<String>(0); // only one child allowed\r
        }\r
 \r
        @Override\r
index 9b69276d33229b0245df48f3fb2f582188ff32a3..df7534299f7ff0c135faa9f7dfa97b6fa3c342a9 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Yuriy Vashchuk (yvashchuk@gmail.com) - Initial API and implementation\r
  *******************************************************************************/\r
@@ -18,54 +18,53 @@ import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;\r
 \r
 import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;\r
-\r
 import org.xml.sax.SAXException;\r
 import org.xml.sax.XMLReader;\r
 \r
 /**\r
  * The SAX based XML parser\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Yuriy Vashchuk\r
  * @author Patrick Tasse\r
  */\r
 public class TmfFilterXMLParser {\r
-       \r
-       private static ITmfFilterTreeNode fRoot = null;\r
-       \r
-       /**\r
-        * The XMLParser constructor\r
-        * \r
-        * @param uri The XML file to parse\r
-        */ \r
-       public TmfFilterXMLParser(final String uri) throws SAXException, IOException {\r
-               \r
-               SAXParserFactory m_parserFactory = null;\r
-               if (m_parserFactory == null) { \r
-            m_parserFactory = SAXParserFactory.newInstance(); \r
-            m_parserFactory.setNamespaceAware(true); \r
-        } \r
 \r
-               XMLReader saxReader = null;\r
-               try {\r
-                       \r
-                       saxReader = m_parserFactory.newSAXParser().getXMLReader();\r
-               saxReader.setContentHandler(new TmfFilterContentHandler());\r
-               saxReader.parse(uri);\r
-               \r
-               fRoot = ((TmfFilterContentHandler) saxReader.getContentHandler()).getTree();\r
-               \r
-               } catch (ParserConfigurationException e) {\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
+    private static ITmfFilterTreeNode fRoot = null;\r
+\r
+    /**\r
+     * The XMLParser constructor\r
+     *\r
+     * @param uri\r
+     *            The XML file to parse\r
+     */\r
+    public TmfFilterXMLParser(final String uri) throws SAXException,\r
+            IOException {\r
+\r
+        SAXParserFactory m_parserFactory = null;\r
+        m_parserFactory = SAXParserFactory.newInstance();\r
+        m_parserFactory.setNamespaceAware(true);\r
+\r
+        XMLReader saxReader = null;\r
+        try {\r
+\r
+            saxReader = m_parserFactory.newSAXParser().getXMLReader();\r
+            saxReader.setContentHandler(new TmfFilterContentHandler());\r
+            saxReader.parse(uri);\r
+\r
+            fRoot = ((TmfFilterContentHandler) saxReader.getContentHandler()).getTree();\r
+\r
+        } catch (ParserConfigurationException e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
 \r
-       /**\r
-        * Getter of tree\r
-        * \r
-        * @return The builded tree\r
-        */ \r
-       public ITmfFilterTreeNode getTree() {\r
-               return fRoot;\r
-       }\r
+    /**\r
+     * Getter of tree\r
+     *\r
+     * @return The builded tree\r
+     */\r
+    public ITmfFilterTreeNode getTree() {\r
+        return fRoot;\r
+    }\r
 }\r
index 3b7412b8700ade27344859687704c3ff25053a62..49c6282059d283bf07c46305a91722da1ba2d3af 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Yuriy Vashchuk (yvashchuk@gmail.com) - Initial API and implementation\r
  *******************************************************************************/\r
@@ -13,7 +13,6 @@
 package org.eclipse.linuxtools.tmf.core.filter.xml;\r
 \r
 import java.io.File;\r
-import java.io.IOException;\r
 \r
 import javax.xml.parsers.DocumentBuilder;\r
 import javax.xml.parsers.DocumentBuilderFactory;\r
@@ -39,26 +38,26 @@ import org.w3c.dom.Element;
 \r
 /**\r
  * The SAX based XML writer\r
- * \r
+ *\r
  * @version 1.0\r
  * @author Yuriy Vashchuk\r
  * @author Patrick Tasse\r
  */\r
 public class TmfFilterXMLWriter {\r
-       \r
+\r
        private Document document = null;\r
-       \r
+\r
        /**\r
         * The XMLParser constructor\r
-        * \r
+        *\r
      * @param root The tree root\r
-        * @throws ParserConfigurationException \r
-        */ \r
-       public TmfFilterXMLWriter(final ITmfFilterTreeNode root) throws IOException, ParserConfigurationException {\r
+        * @throws ParserConfigurationException\r
+        */\r
+       public TmfFilterXMLWriter(final ITmfFilterTreeNode root) throws ParserConfigurationException {\r
                DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();\r
                DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();\r
                document = documentBuilder.newDocument();\r
-               \r
+\r
                Element rootElement = document.createElement(root.getNodeName());\r
                document.appendChild(rootElement);\r
 \r
@@ -69,84 +68,84 @@ public class TmfFilterXMLWriter {
 \r
        /**\r
         * The Tree to XML parser\r
-        * \r
+        *\r
         * @param document The XML document\r
         * @param treenode The node to write\r
         * @param parentElement The XML element of the parent\r
-        */ \r
+        */\r
        public static void buildXMLTree(final Document document, final ITmfFilterTreeNode treenode, Element parentElement) {\r
                Element element = document.createElement(treenode.getNodeName());\r
-               \r
+\r
                if (treenode instanceof TmfFilterNode) {\r
-                       \r
+\r
                        TmfFilterNode node = (TmfFilterNode) treenode;\r
                        element.setAttribute(TmfFilterNode.NAME_ATTR, node.getFilterName());\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterEventTypeNode) {\r
-                       \r
+\r
                        TmfFilterEventTypeNode node = (TmfFilterEventTypeNode) treenode;\r
                        element.setAttribute(TmfFilterEventTypeNode.TYPE_ATTR, node.getEventType());\r
                        element.setAttribute(TmfFilterEventTypeNode.NAME_ATTR, node.getName());\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterAndNode) {\r
-                       \r
+\r
                        TmfFilterAndNode node = (TmfFilterAndNode) treenode;\r
                        element.setAttribute(TmfFilterAndNode.NOT_ATTR, Boolean.toString(node.isNot()));\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterOrNode) {\r
-                       \r
+\r
                        TmfFilterOrNode node = (TmfFilterOrNode) treenode;\r
                        element.setAttribute(TmfFilterOrNode.NOT_ATTR, Boolean.toString(node.isNot()));\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterContainsNode) {\r
-                       \r
+\r
                        TmfFilterContainsNode node = (TmfFilterContainsNode) treenode;\r
                        element.setAttribute(TmfFilterContainsNode.NOT_ATTR, Boolean.toString(node.isNot()));\r
                        element.setAttribute(TmfFilterContainsNode.FIELD_ATTR, node.getField());\r
                        element.setAttribute(TmfFilterContainsNode.VALUE_ATTR, node.getValue());\r
                        element.setAttribute(TmfFilterContainsNode.IGNORECASE_ATTR, Boolean.toString(node.isIgnoreCase()));\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterEqualsNode) {\r
-                       \r
+\r
                        TmfFilterEqualsNode node = (TmfFilterEqualsNode) treenode;\r
                        element.setAttribute(TmfFilterEqualsNode.NOT_ATTR, Boolean.toString(node.isNot()));\r
                        element.setAttribute(TmfFilterEqualsNode.FIELD_ATTR, node.getField());\r
                        element.setAttribute(TmfFilterEqualsNode.VALUE_ATTR, node.getValue());\r
                        element.setAttribute(TmfFilterEqualsNode.IGNORECASE_ATTR, Boolean.toString(node.isIgnoreCase()));\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterMatchesNode) {\r
-                       \r
+\r
                        TmfFilterMatchesNode node = (TmfFilterMatchesNode) treenode;\r
                        element.setAttribute(TmfFilterMatchesNode.NOT_ATTR, Boolean.toString(node.isNot()));\r
                        element.setAttribute(TmfFilterMatchesNode.FIELD_ATTR, node.getField());\r
                        element.setAttribute(TmfFilterMatchesNode.REGEX_ATTR, node.getRegex());\r
-                       \r
+\r
                } else if (treenode instanceof TmfFilterCompareNode) {\r
-                       \r
+\r
                        TmfFilterCompareNode node = (TmfFilterCompareNode) treenode;\r
                        element.setAttribute(TmfFilterCompareNode.NOT_ATTR, Boolean.toString(node.isNot()));\r
                        element.setAttribute(TmfFilterCompareNode.FIELD_ATTR, node.getField());\r
                        element.setAttribute(TmfFilterCompareNode.RESULT_ATTR, Integer.toString(node.getResult()));\r
                        element.setAttribute(TmfFilterCompareNode.TYPE_ATTR, node.getType().toString());\r
                        element.setAttribute(TmfFilterCompareNode.VALUE_ATTR, node.getValue());\r
-                       \r
+\r
                }\r
-               \r
+\r
                parentElement.appendChild(element);\r
-               \r
+\r
                for (int i = 0; i < treenode.getChildrenCount(); i++) {\r
                        buildXMLTree(document, treenode.getChild(i), element);\r
                }\r
        }\r
-       \r
+\r
        /**\r
-        * Save the tree \r
-        * \r
+        * Save the tree\r
+        *\r
         * @param uri The new Filter XML path\r
-        */ \r
+        */\r
        public void saveTree(final String uri) {\r
                TransformerFactory transformerFactory = TransformerFactory.newInstance();\r
-               \r
+\r
                try {\r
                        Transformer transformer = transformerFactory.newTransformer();\r
                DOMSource source = new DOMSource(document);\r
@@ -158,5 +157,5 @@ public class TmfFilterXMLWriter {
                        e.printStackTrace();\r
                }\r
        }\r
-       \r
+\r
 }\r
index 234913c8f7371a8621b155c501e90705993b7e98..1e41dcac1a67db28b382b9ecbf5597fc85d2dd77 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation, based on article by Nick Zhang\r
  *                   (http://www.javaworld.com/javatips/jw-javatip26.html)\r
@@ -19,8 +19,8 @@ import java.io.RandomAccessFile;
 import java.nio.charset.Charset;\r
 \r
 /**\r
- * A class to mitigate the Java I/O inefficiency of RandomAccessFile. \r
- * \r
+ * A class to mitigate the Java I/O inefficiency of RandomAccessFile.\r
+ *\r
  * @version 1.0\r
  * @author Patrick Tasse\r
  */\r
@@ -28,22 +28,22 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
 \r
        private static final int DEFAULT_BUF_SIZE = 8192;\r
        private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8"); //$NON-NLS-1$\r
-       \r
+\r
        final int BUF_SIZE;\r
        byte buffer[];\r
        int buf_end = 0;\r
        int buf_pos = 0;\r
        long real_pos = 0;\r
        StringBuilder sb = new StringBuilder();\r
-       \r
+\r
        public BufferedRandomAccessFile(String name, String mode) throws IOException {\r
                this(name, mode, DEFAULT_BUF_SIZE);\r
        }\r
-       \r
+\r
        public BufferedRandomAccessFile(File file, String mode) throws IOException {\r
                this(file, mode, DEFAULT_BUF_SIZE);\r
        }\r
-       \r
+\r
        public BufferedRandomAccessFile(String name, String mode, int bufsize) throws IOException {\r
            super(name, mode);\r
            invalidate();\r
@@ -67,11 +67,10 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
                }\r
                if (buf_end == 0) {\r
                        return -1;\r
-               } else {\r
-                       return buffer[buf_pos++];\r
                }\r
+        return buffer[buf_pos++];\r
        }\r
-       \r
+\r
        @Override\r
     public int read(byte b[], int off, int len) throws IOException {\r
                int leftover = buf_end - buf_pos;\r
@@ -90,7 +89,7 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
                }\r
                return len;\r
        }\r
-       \r
+\r
        @Override\r
     public long getFilePointer() throws IOException{\r
                long l = real_pos;\r
@@ -144,7 +143,7 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
                buf_pos = lineend + 1;\r
                return str;\r
        }\r
-         \r
+\r
        private int fillBuffer() throws IOException {\r
                int n = super.read(buffer, 0, BUF_SIZE);\r
                if (n >= 0) {\r
@@ -154,7 +153,7 @@ public class BufferedRandomAccessFile extends RandomAccessFile {
                }\r
                return n;\r
        }\r
-       \r
+\r
        private void invalidate() throws IOException {\r
                buf_end = 0;\r
                buf_pos = 0;\r
index e78464172ad9d3de564ff2c518e4cc47cc95269f..4cfd494b6f63c4b7232680d05efeeb3bdea5b283 100644 (file)
@@ -26,8 +26,8 @@ public interface ITmfDataRequest<T extends ITmfEvent> {
        // Constants
        // ------------------------------------------------------------------------
 
-    public enum ExecutionType { BACKGROUND, FOREGROUND };
-    
+    public enum ExecutionType { BACKGROUND, FOREGROUND }
+
        // ------------------------------------------------------------------------
        // Accessors
        // ------------------------------------------------------------------------
index e0bec7cc7046cb6cdcb4e830dc2a7e936b7b65b6..7876c83a127535232e0c61612e3e97990667cba5 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -18,7 +18,7 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
 
 /**
  * The generic trace indexer in TMF with support for incremental indexing.
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  *
@@ -50,33 +50,33 @@ public interface ITmfTraceIndexer<T extends ITmfTrace<ITmfEvent>> {
      * TmfTimeRange range = new TmfTimeRange(T1, T2);
      * trace.getIndexer().buildIndex(100, range, false);
      * </pre>
-     * 
+     *
      * @param offset The offset of the first event to consider
      * @param range The time range to consider
      * @param waitForCompletion
      */
     public void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
-    
+
     /**
      * Indicates that the indexer is busy indexing the trace.
-     * Will always return false if the indexing is done synchronously. 
-     * 
+     * Will always return false if the indexing is done synchronously.
+     *
      * @return the state of the indexer (indexing or not)
      */
     public boolean isIndexing();
-    
+
     /**
-     * Adds an entry to the trace index. 
-     * 
+     * Adds an entry to the trace index.
+     *
      * @param context
      * @param timestamp
      */
     public void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
-    
+
     /**
      * Returns the context of the checkpoint immediately preceding the requested
      * timestamp (or at the timestamp if it coincides with a checkpoint).
-     * 
+     *
      * @param timestamp the requested timestamp
      * @return the checkpoint context
      */
@@ -85,7 +85,7 @@ public interface ITmfTraceIndexer<T extends ITmfTrace<ITmfEvent>> {
     /**
      * Returns the context of the checkpoint immediately preceding the requested
      * rank (or at rank if it coincides with a checkpoint).
-     * 
+     *
      * @param rank the requested event rank
      * @return the checkpoint context
      */
index 1c5b958d9830f49d7ce6637b938c592618f001c3..7f987d9ed19c5952d5799f30283783b7fd589319 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * 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:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
+import org.eclipse.linuxtools.tmf.core.component.TmfDataProvider;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
@@ -32,7 +33,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
 
 /**
  * A simple indexer that manages the trace index as an array of trace
- * checkpoints. Checkpoints are stored at fixed intervals (event rank) in 
+ * checkpoints. Checkpoints are stored at fixed intervals (event rank) in
  * ascending timestamp order.
  * <p>
  * The goal being to access a random trace event reasonably fast from the user's
@@ -42,7 +43,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
  * <p>
  * Locating a specific checkpoint is trivial for both rank (rank % interval) and
  * timestamp (bsearch in the array).
- * 
+ *
  * @version 1.0
  * @author Francois Chouinard
  *
@@ -71,10 +72,10 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
     protected final List<ITmfCheckpoint> fTraceIndex;
 
     /**
-     * The indexing request 
+     * The indexing request
      */
     private ITmfEventRequest<ITmfEvent> fIndexingRequest = null;
-    
+
     // ------------------------------------------------------------------------
     // Construction
     // ------------------------------------------------------------------------
@@ -82,16 +83,16 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
     /**
      * Basic constructor that uses the default trace block size as checkpoints
      * intervals
-     * 
+     *
      * @param trace the trace to index
      */
     public TmfCheckpointIndexer(final ITmfTrace<ITmfEvent> trace) {
-        this(trace, TmfTrace.DEFAULT_BLOCK_SIZE);
+        this(trace, TmfDataProvider.DEFAULT_BLOCK_SIZE);
     }
 
     /**
      * Full trace indexer
-     * 
+     *
      * @param trace the trace to index
      * @param interval the checkpoints interval
      */
@@ -130,11 +131,11 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
     // ------------------------------------------------------------------------
 
     /* (non-Javadoc)
-     * 
+     *
      * The index is a list of contexts that point to events at regular interval
      * (rank-wise) in the trace. After it is built, the index can be used to
      * quickly access any event by rank or timestamp (using seekIndex()).
-     * 
+     *
      * The index is built simply by reading the trace
      *
      * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer#buildIndex(long, org.eclipse.linuxtools.tmf.core.event.TmfTimeRange, boolean)
@@ -142,7 +143,7 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
     @Override
     public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) {
 
-        // Don't do anything if we are already indexing 
+        // Don't do anything if we are already indexing
         synchronized (fTraceIndex) {
             if (fIsIndexing) {
                 return;
@@ -223,7 +224,7 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
 
     /**
      * Notify the interested parties that the trace time range has changed
-     * 
+     *
      * @param startTime the new start time
      * @param endTime the new end time
      */
@@ -299,7 +300,7 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
 
     /**
      * Position the trace at the given checkpoint
-     * 
+     *
      * @param checkpoint the checkpoint index
      * @return the corresponding context
      */
@@ -335,7 +336,7 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
     // Context conversion functions
     // ------------------------------------------------------------------------
 
-    private ITmfContext shrinkContext(ITmfContext context) {
+    private static ITmfContext shrinkContext(ITmfContext context) {
         if (context instanceof TmfExperimentContext) {
             return shrinkExpContext(context);
         }
@@ -343,7 +344,7 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
         return ctx;
     }
 
-    private ITmfContext shrinkExpContext(ITmfContext context) {
+    private static ITmfContext shrinkExpContext(ITmfContext context) {
         TmfExperimentContext expContext = (TmfExperimentContext) context;
         int size = expContext.getContexts().length;
         ITmfContext[] trcCtxts = new TmfContext[size];
index a6a189cd1659c9c1969e8ef534d8961030904606..7d62f4334fb57ec084e0669a41466468227d189c 100644 (file)
@@ -88,7 +88,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
      * @param type
      * @param id
      * @param traces
-     * @throws TmfTraceException 
+     * @throws TmfTraceException
      */
     public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces) {
         this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE);
@@ -99,7 +99,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
      * @param id
      * @param traces
      * @param indexPageSize
-     * @throws TmfTraceException 
+     * @throws TmfTraceException
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
     public TmfExperiment(final Class<T> type, final String path, final ITmfTrace<T>[] traces, final int indexPageSize) {
@@ -137,8 +137,9 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
         }
 
         if (fTraces != null) {
-            for (final ITmfTrace trace : fTraces)
+            for (final ITmfTrace trace : fTraces) {
                 trace.dispose();
+            }
             fTraces = null;
         }
         super.dispose();
@@ -169,7 +170,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Selects the current, framework-wide, experiment
-     * 
+     *
      * @param experiment das experiment
      */
     public static void setCurrentExperiment(final TmfExperiment<?> experiment) {
@@ -188,7 +189,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Get the list of traces. Handle with care...
-     * 
+     *
      * @return the experiment traces
      */
     public ITmfTrace<T>[] getTraces() {
@@ -198,7 +199,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
     /**
      * Returns the timestamp of the event at the requested index. If none,
      * returns null.
-     * 
+     *
      * @param index the event index (rank)
      * @return the corresponding event timestamp
      */
@@ -210,7 +211,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Set the file to be used for bookmarks on this experiment
-     * 
+     *
      * @param file the bookmarks file
      */
     public void setBookmarksFile(final IFile file) {
@@ -219,7 +220,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Get the file used for bookmarks on this experiment
-     * 
+     *
      * @return the bookmarks file or null if none is set
      */
     public IFile getBookmarksFile() {
@@ -235,12 +236,12 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
      */
     @Override
     protected synchronized ITmfContext armRequest(final ITmfDataRequest<T> request) {
-        
+
         // Make sure we have something to read from
         if (fTraces == null) {
             return null;
         }
-        
+
         if (request instanceof ITmfEventRequest<?>
             && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest<T>) request).getRange().getStartTime())
             && request.getIndex() == 0)
@@ -265,19 +266,19 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /* (non-Javadoc)
      * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#seekEvent(long)
-     * 
+     *
      * TmfTrace.seekEvent(rank) will return a context that will position the
      * trace to read the event at rank 'rank' in the trace. In the case of an
      * experiment context, that event has to be actually read in the fEvents
      * buffer and the corresponding trace context has to point to the next
      * event (rank + 1) in the trace (the sum of the traces contexts ranks
      * should equal [exp context rank + #traces] (corner cases not considered).
-     * 
+     *
      * In the likely case that TmfTrace.seekEvent() computed the context
      * by using a read loop (reading from the experiment), the 'lastTraceRead'
      * field will be set to the actual trace that needs to be read to obtain
      * event at rank 'rank'.
-     * 
+     *
      * Therefore, if 'lastTraceRead' is set, we need to read that particular
      * trace *and* then decrease the context rank (which has to correspond to
      * the rank of the event to be returned next by TmfExperiemnt.getNext().
@@ -296,9 +297,9 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /* (non-Javadoc)
      *
-     * Returns a brand new context based on the location provided and 
+     * Returns a brand new context based on the location provided and
      * initializes the event queues
-     * 
+     *
      * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
      */
     @Override
@@ -314,7 +315,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
         // Instantiate the location
         final TmfExperimentLocation expLocation = (location == null)
-                ? new TmfExperimentLocation(new TmfLocationArray(new ITmfLocation<?>[fTraces.length])) 
+                ? new TmfExperimentLocation(new TmfLocationArray(new ITmfLocation<?>[fTraces.length]))
                 : (TmfExperimentLocation) location.clone();
 
         // Create and populate the context's traces contexts
@@ -334,7 +335,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
         context.setRank(ITmfContext.UNKNOWN_RANK);
 
         fExperimentContext = context;
-        return (ITmfContext) context;
+        return context;
     }
 
     // ------------------------------------------------------------------------
@@ -454,7 +455,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
      */
     @Override
     @SuppressWarnings("nls")
-    public String toString() {
+    public synchronized String toString() {
         return "[TmfExperiment (" + getName() + ")]";
     }
 
@@ -472,8 +473,9 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
         if (getStreamingInterval() == 0) {
             final ITmfContext context = seekEvent(0);
             final ITmfEvent event = getNext(context);
-            if (event == null)
+            if (event == null) {
                 return;
+            }
             final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp().clone(), TmfTimestamp.BIG_CRUNCH);
             final TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange);
 
@@ -498,15 +500,18 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
                         ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
                         ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
                         for (final ITmfTrace<T> trace : fTraces) {
-                            if (trace.getStartTime().compareTo(startTimestamp) < 0)
+                            if (trace.getStartTime().compareTo(startTimestamp) < 0) {
                                 startTimestamp = trace.getStartTime();
-                            if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0)
+                            }
+                            if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) {
                                 endTimestamp = trace.getEndTime();
+                            }
                         }
-                        if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0)
+                        if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0) {
                             timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
-                        else
+                        } else {
                             timeRange = null;
+                        }
                         safeTimestamp = endTimestamp;
                         if (timeRange != null) {
                             final TmfExperimentRangeUpdatedSignal signal =
@@ -531,8 +536,9 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
     @Override
     public long getStreamingInterval() {
         long interval = 0;
-        for (final ITmfTrace<T> trace : fTraces)
+        for (final ITmfTrace<T> trace : fTraces) {
             interval = Math.max(interval, trace.getStreamingInterval());
+        }
         return interval;
     }
 
@@ -544,7 +550,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Signal handler for the TmfExperimentSelectedSignal signal
-     * 
+     *
      * @param signal
      */
     @TmfSignalHandler
@@ -558,7 +564,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Signal handler for the TmfEndSynchSignal signal
-     * 
+     *
      * @param signal
      */
     @TmfSignalHandler
@@ -571,7 +577,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Signal handler for the TmfTraceUpdatedSignal signal
-     * 
+     *
      * @param signal
      */
     @TmfSignalHandler
@@ -583,7 +589,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
 
     /**
      * Signal handler for the TmfExperimentRangeUpdatedSignal signal
-     * 
+     *
      * @param signal
      */
     @TmfSignalHandler
index 50abe774fce01c67e38637e202c4e24d3888490b..f1a4804562cfff5a0917c64c2f087f03e70def6c 100644 (file)
@@ -16,7 +16,7 @@ package org.eclipse.linuxtools.tmf.core.trace;
 import java.io.File;
 
 import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
@@ -213,7 +213,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
         String traceName = (resource != null) ? resource.getName() : null;
         // If no resource was provided, extract the display name the trace path
         if (traceName == null) {
-            final int sep = path.lastIndexOf(Path.SEPARATOR);
+            final int sep = path.lastIndexOf(IPath.SEPARATOR);
             traceName = (sep >= 0) ? path.substring(sep + 1) : path;
         }
         if (fParser == null) {
index ef1b7ac2ff7eb0e9968f2f80dd105f58ba11949a..23134cd8b0ecd49df6ad6d1b7be682c63cffaee4 100755 (executable)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011, 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:
  *   Francois Godin (copelnug@gmail.com)        - Initial design and implementation
  *   Mathieu Denis  (mathieu.denis@polymtl.ca)  - Correction and refactoring
@@ -21,7 +21,7 @@ import java.util.RandomAccess;
 
 /**
  * <h4>Allow to create a List object that contain an already existing array.</h4>
- * <p>Works like {@link java.util.Arrays#asList} but offers more functions : 
+ * <p>Works like {@link java.util.Arrays#asList} but offers more functions :
  * <ul>
  *  <li>{@link #hashCode()}</li>
  *  <li>{@link #equals(Object)}</li>
@@ -84,7 +84,7 @@ public final class TmfFixedArray<T> extends AbstractList<T> implements RandomAcc
      * @param array Array to use. WILL NOT BE COPIED.
      */
     public TmfFixedArray(final T... array) {
-        fArray = array; 
+        fArray = array;
     }
     /**
      * Append a FixedArray to this FixedArray.
@@ -103,8 +103,9 @@ public final class TmfFixedArray<T> extends AbstractList<T> implements RandomAcc
      */
     public TmfFixedArray<T> append(final TmfFixedArray<T>... values) {
         int newLength = 0;
-        for(TmfFixedArray<T> value : values)
+        for(TmfFixedArray<T> value : values) {
             newLength += value.size();
+        }
                 TmfFixedArray<T> result = new TmfFixedArray<T>(copyOf(fArray, fArray.length + newLength));
         newLength = fArray.length;
         for(TmfFixedArray<T> value : values)
@@ -131,8 +132,9 @@ public final class TmfFixedArray<T> extends AbstractList<T> implements RandomAcc
      */
     public TmfFixedArray<T> append(final T... values) {
         TmfFixedArray<T> result = new TmfFixedArray<T>(copyOf(fArray, fArray.length + values.length));
-        for(int i = 0; i < values.length; ++i)
+        for(int i = 0; i < values.length; ++i) {
             result.set(fArray.length + i, values[i]);
+        }
         return result;
     }
     /*
@@ -150,13 +152,17 @@ public final class TmfFixedArray<T> extends AbstractList<T> implements RandomAcc
      */
     @Override
     public boolean equals(Object o) {
-        if(o instanceof TmfFixedArray<?>)
+        if(o instanceof TmfFixedArray<?>) {
             return Arrays.equals(fArray, ((TmfFixedArray<?>)o).fArray);
-        if(!(o instanceof List))
+        }
+        if(!(o instanceof List)) {
             return false;
-        for(int i = 0; i < fArray.length; ++i)
-            if(!fArray[i].equals((List<?>)o))
+        }
+        for(int i = 0; i < fArray.length; ++i) {
+            if(!fArray[i].equals(o)) {
                 return false;
+            }
+        }
         return true;
     }
     /*
@@ -235,11 +241,13 @@ public final class TmfFixedArray<T> extends AbstractList<T> implements RandomAcc
     @SuppressWarnings("unchecked")
     public <E> E[] toArray(E[] array)
     {
-        if(array.length < fArray.length)
+        if(array.length < fArray.length) {
             return copyOf(fArray, fArray.length,(Class<? extends E[]>)array.getClass());
+        }
         System.arraycopy(fArray, 0, array, 0, fArray.length);
-        if(array.length > fArray.length)
+        if(array.length > fArray.length) {
             array[fArray.length] = null;
+        }
         return array;
     }
     /*
index 2b2d4c91269babbfb9792d5538e64b09ee10f2ad..3356882ea2487ccc81a85228a718a42b9528e371 100644 (file)
@@ -71,8 +71,6 @@ public class FilterManager {
                try {\r
                TmfFilterXMLWriter writerXML = new TmfFilterXMLWriter(fRoot);\r
                writerXML.saveTree(SAVED_FILTERS_PATH_NAME);\r
-        } catch (IOException e) {\r
-            Activator.getDefault().logError("Error saving filter xml file: " + SAVED_FILTERS_PATH_NAME, e); //$NON-NLS-1$\r
         } catch (ParserConfigurationException e) {\r
             Activator.getDefault().logError("Error saving filter xml file: " + SAVED_FILTERS_PATH_NAME, e); //$NON-NLS-1$\r
         }\r
index d9e60adaf02777e9c22c81a2ba31c3664c93dcec..73fcb6be3db272cf635e52e6571d75e87f0ccdfa 100644 (file)
@@ -264,8 +264,6 @@ public class FilterView extends TmfView {
 \r
                        } catch (ParserConfigurationException e) {\r
                            Activator.getDefault().logError("Error parsing filter xml file", e); //$NON-NLS-1$\r
-                       } catch (IOException e) {\r
-                           Activator.getDefault().logError("Error parsing filter xml file", e); //$NON-NLS-1$\r
                        }\r
                }\r
        }\r
This page took 0.109445 seconds and 5 git commands to generate.