tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / BasicFrame.java
index 3001373c0e0c55f7d1c3134d84ff5ad717d9eba1..d17bcbcb27f0b4794b71128b1518cca5f14e7aae 100755 (executable)
@@ -1,24 +1,23 @@
 /**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2013 IBM Corporation, 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:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *     IBM - Initial API and implementation
+ *     Bernd Hufmann - Updated for TMF
  **********************************************************************/
+
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
@@ -201,9 +200,8 @@ public class BasicFrame extends GraphNode {
     public int getWidth() {
         if (fHorizontalIndex == 0) {
             return 3 * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 - Metrics.FRAME_H_MARGIN - Metrics.LIFELINE_SPACING / 2;
-        } else {
-            return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
         }
+        return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
     }
 
     /*
@@ -243,7 +241,7 @@ public class BasicFrame extends GraphNode {
             return null;
         }
         for (int i = fromIndex; i < list.size(); i++) {
-            GraphNode node = (GraphNode) list.get(i);
+            GraphNode node = list.get(i);
             // only lifeline list is x ordered
             // Stop browsing the list if the node is outside the visible area
             // all others nodes will be not visible
@@ -393,6 +391,7 @@ public class BasicFrame extends GraphNode {
      * Return the minimum time stored in the frame taking all GraphNodes into account
      *
      * @return the minimum GraphNode time
+     * @since 2.0
      */
     public ITmfTimestamp getMinTime() {
         if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
@@ -411,6 +410,7 @@ public class BasicFrame extends GraphNode {
      *
      * @param min
      *            The minimum timestamp
+     * @since 2.0
      */
     public void setMin(ITmfTimestamp min) {
         fMinTime = min;
@@ -422,6 +422,7 @@ public class BasicFrame extends GraphNode {
      *
      * @param max
      *            The maximum timestamp
+     * @since 2.0
      */
     public void setMax(ITmfTimestamp max) {
         fMaxTime = max;
@@ -440,6 +441,7 @@ public class BasicFrame extends GraphNode {
      * Return the maximum time stored in the frame taking all GraphNodes into account
      *
      * @return the maximum GraphNode time
+     * @since 2.0
      */
     public ITmfTimestamp getMaxTime() {
         if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
@@ -467,7 +469,7 @@ public class BasicFrame extends GraphNode {
             return;
         }
         for (int i = 0; i < timeArray.size(); i++) {
-            SDTimeEvent m = (SDTimeEvent) timeArray.get(i);
+            SDTimeEvent m = timeArray.get(i);
 
             if (m.getTime().compareTo(fMaxSDTime, true) > 0) {
                 fMaxSDTime = m.getTime();
@@ -484,6 +486,7 @@ public class BasicFrame extends GraphNode {
      * Returns the minimum time between consecutive messages.
      *
      * @return the minimum time between consecutive messages
+     * @since 2.0
      */
     public ITmfTimestamp getSDMinTime() {
         computeMaxMinTime();
@@ -494,6 +497,7 @@ public class BasicFrame extends GraphNode {
      * Returns the maximum time between consecutive messages.
      *
      * @return the maximum time between consecutive messages
+     * @since 2.0
      */
     public ITmfTimestamp getSDMaxTime() {
         computeMaxMinTime();
@@ -510,8 +514,8 @@ public class BasicFrame extends GraphNode {
             return;
         }
         for (int i = 0; i < timeArray.size() - 1; i++) {
-            SDTimeEvent m1 = (SDTimeEvent) timeArray.get(i);
-            SDTimeEvent m2 = (SDTimeEvent) timeArray.get(i + 1);
+            SDTimeEvent m1 = timeArray.get(i);
+            SDTimeEvent m2 = timeArray.get(i + 1);
 
             updateMinMax(m1, m2);
         }
@@ -526,20 +530,20 @@ public class BasicFrame extends GraphNode {
     protected void updateMinMax(SDTimeEvent m1, SDTimeEvent m2) {
         ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime());
         if (fComputeMinMax) {
-            fMinTime = delta.clone();
+            fMinTime = delta;
             if (fMinTime.compareTo(TmfTimestamp.ZERO, false) < 0) {
                 fMinTime = new TmfTimestamp(0, m1.getTime().getScale(), m1.getTime().getPrecision());
             }
-            fMaxTime = fMinTime.clone();
+            fMaxTime = fMinTime;
             fComputeMinMax = false;
         }
 
         if ((delta.compareTo(fMinTime, true) < 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
-            fMinTime = delta.clone();
+            fMinTime = delta;
         }
 
         if ((delta.compareTo(fMaxTime, true) > 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
-            fMaxTime = delta.clone();
+            fMaxTime = delta;
         }
     }
 
@@ -557,15 +561,15 @@ public class BasicFrame extends GraphNode {
         List<SDTimeEvent> timeArray = new ArrayList<SDTimeEvent>();
         while (it.hasNext()) {
             String nodeType = it.next();
-            List<GraphNode> list = (List<GraphNode>) fNodes.get(nodeType);
+            List<GraphNode> list = fNodes.get(nodeType);
             for (int i = 0; i < list.size(); i++) {
                 Object timedNode = list.get(i);
                 if ((timedNode instanceof ITimeRange) && ((ITimeRange) timedNode).hasTimeInfo()) {
-                    int event = ((GraphNode) list.get(i)).getStartOccurrence();
+                    int event = list.get(i).getStartOccurrence();
                     ITmfTimestamp time = ((ITimeRange) list.get(i)).getStartTime();
                     SDTimeEvent f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
                     timeArray.add(f);
-                    if (event != ((GraphNode) list.get(i)).getEndOccurrence()) {
+                    if (event != list.get(i).getEndOccurrence()) {
                         event = ((AsyncMessage) list.get(i)).getEndOccurrence();
                         time = ((ITimeRange) list.get(i)).getEndTime();
                         f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
This page took 0.027355 seconds and 5 git commands to generate.