Merge branch 'master' into lttng-kepler
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / trace / TmfContext.java
index 1b67039e5ad1d92dd9083969864e02fac1497650..d0dd6c3e50578a1f3c9aa353c7dd4cd378ae3f1b 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
 package org.eclipse.linuxtools.tmf.core.trace;
 
 /**
- * <b><u>TmfContext</u></b>
+ * A basic implementation of ITmfContext.
  * <p>
- * Trace context structure. It ties a trace location to an event rank. The
- * context should be enough to restore the trace state so the corresponding
- * event can be read.
+ * It ties a trace location to an event rank. The context should be enough to
+ * restore the trace state so the corresponding event can be read.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfLocation
  */
 public class TmfContext implements ITmfContext, Cloneable {
 
@@ -27,7 +31,7 @@ public class TmfContext implements ITmfContext, Cloneable {
     // ------------------------------------------------------------------------
 
     // The trace location
-    private ITmfLocation<? extends Comparable<?>> fLocation;
+    private ITmfLocation fLocation;
 
     // The event rank
     private long fRank;
@@ -45,32 +49,33 @@ public class TmfContext implements ITmfContext, Cloneable {
 
     /**
      * Simple constructor (unknown rank)
-     * 
+     *
      * @param location the event location
      */
-    public TmfContext(final ITmfLocation<? extends Comparable<?>> location) {
+    public TmfContext(final ITmfLocation location) {
         this(location, UNKNOWN_RANK);
     }
 
     /**
      * Full constructor
-     * 
+     *
      * @param location the event location
      * @param rank the event rank
      */
-    public TmfContext(final ITmfLocation<? extends Comparable<?>> location, final long rank) {
+    public TmfContext(final ITmfLocation location, final long rank) {
         fLocation = location;
         fRank = rank;
     }
 
     /**
      * Copy constructor
-     * 
+     *
      * @param context the other context
      */
     public TmfContext(final TmfContext context) {
-        if (context == null)
+        if (context == null) {
             throw new IllegalArgumentException();
+        }
         fLocation = context.fLocation;
         fRank = context.fRank;
     }
@@ -102,7 +107,7 @@ public class TmfContext implements ITmfContext, Cloneable {
      * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getLocation()
      */
     @Override
-    public ITmfLocation<? extends Comparable<?>> getLocation() {
+    public ITmfLocation getLocation() {
         return fLocation;
     }
 
@@ -110,7 +115,7 @@ public class TmfContext implements ITmfContext, Cloneable {
      * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setLocation(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
      */
     @Override
-    public void setLocation(final ITmfLocation<? extends Comparable<?>> location) {
+    public void setLocation(final ITmfLocation location) {
         fLocation = location;
     }
 
@@ -135,8 +140,9 @@ public class TmfContext implements ITmfContext, Cloneable {
      */
     @Override
     public void increaseRank() {
-        if (hasValidRank())
+        if (hasValidRank()) {
             fRank++;
+        }
     }
 
     /* (non-Javadoc)
@@ -175,20 +181,26 @@ public class TmfContext implements ITmfContext, Cloneable {
      */
     @Override
     public boolean equals(final Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         final TmfContext other = (TmfContext) obj;
         if (fLocation == null) {
-            if (other.fLocation != null)
+            if (other.fLocation != null) {
                 return false;
-        } else if (!fLocation.equals(other.fLocation))
+            }
+        } else if (!fLocation.equals(other.fLocation)) {
             return false;
-        if (fRank != other.fRank)
+        }
+        if (fRank != other.fRank) {
             return false;
+        }
         return true;
     }
 
This page took 0.026984 seconds and 5 git commands to generate.