ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / Lifeline.java
index 2092ebd5bd1a40c712f5e369c7ff6807159f70e4..ff77a30ec7c820823279063b943881b294a8dc78 100755 (executable)
@@ -1,15 +1,15 @@
 /**********************************************************************
- * Copyright (c) 2005, 2008, 2011 IBM Corporation and others.
+ * 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
- * $Id: Lifeline.java,v 1.3 2008/01/24 02:28:49 apnan Exp $
- * 
- * Contributors: 
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ *     IBM - Initial API and implementation
+ *     Bernd Hufmann - Updated for TMF
  **********************************************************************/
+
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
 
 import java.util.ArrayList;
@@ -18,7 +18,8 @@ import java.util.List;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage;
-import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 
 /**
  * Lifeline is the UML2 lifeline graphical representation.<br>
@@ -27,36 +28,61 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences;
  * Event occurrence define the drawing order of graph node along a lifeline. In this lifeline implementation, event
  * occurrences are just integer index. The event occurrences with the same value on different lifelines will correspond
  * the same y coordinate value.
- * 
+ *
+ * @version 1.0
  * @author sveyrier
- * 
+ *
  */
 public class Lifeline extends GraphNode {
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    /**
+     * The life line tag.
+     */
+    public static final String LIFELINE_TAG = "Lifeline"; //$NON-NLS-1$
 
+    // ------------------------------------------------------------------------
+    // Attribute
+    // ------------------------------------------------------------------------
     /**
      * The lifeline position in the containing frame
      */
-    protected int indexInFrame = 0;
-
+    private int fIndexInFrame = 0;
     /**
      * The frame where the lifeline is drawn
      */
-    protected Frame frame = null;
-
+    private Frame fFrame = null;
     /**
      * The current event occurrence created in the lifeline
      */
-    protected int eventOccurrence = 0;
-
-    public static final String LIFELINE_TAG = "Lifeline"; //$NON-NLS-1$
+    private int fEventOccurrence = 0;
+    /**
+     * The lifeline category.
+     */
+    private int fCategory = -1;
+    /**
+     * Flag whether lifeline has time information available or not
+     */
+    private boolean fHasTimeInfo = false;
 
-    protected int category = -1;
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * Default constructor
+     */
+    public Lifeline() {
+        setColorPrefId(ISDPreferences.PREF_LIFELINE);
+    }
 
-    protected boolean hasTime = false;
+    // ------------------------------------------------------------------------
+    // Methods
+    // ------------------------------------------------------------------------
 
     @Override
     public int getX() {
-        return Metrics.FRAME_H_MARGIN + Metrics.LIFELINE_H_MAGIN + (indexInFrame - 1) * Metrics.swimmingLaneWidth();
+        return Metrics.FRAME_H_MARGIN + Metrics.LIFELINE_H_MAGIN + (fIndexInFrame - 1) * Metrics.swimmingLaneWidth();
     }
 
     @Override
@@ -76,92 +102,99 @@ public class Lifeline extends GraphNode {
         + 2 * Metrics.LIFELINE_NAME_H_MARGIN;
     }
 
-    public Lifeline() {
-        prefId = ISDPreferences.PREF_LIFELINE;
-    }
-
     /**
      * Set the lifeline category for this lifeline.
-     * 
+     *
      * @param arrayIndex the index of the category to use
      * @see Frame#setLifelineCategories(LifelineCategories[])
      */
     public void setCategory(int arrayIndex) {
-        category = arrayIndex;
+        fCategory = arrayIndex;
+    }
+
+    /**
+     * Gets the lifeline category for this lifeline.
+     *
+     * @return arrayIndex the index of the category to use
+     * @since 2.0
+     */
+    public int getCategory() {
+        return fCategory;
     }
 
     /**
      * Returns the tooltip text for the lifeline. It is the combination between the category name(if any) and the
      * lifeline name
-     * 
+     *
      * @return the tooltip text
      */
     public String getToolTipText() {
-        if (category >= 0) {
-            LifelineCategories[] categories = frame.getLifelineCategories();
-            if (category < categories.length) {
-                return categories[category].getName() + " " + getName(); //$NON-NLS-1$
-            } else
-                return ""; //$NON-NLS-1$
-        } else
-            return ""; //$NON-NLS-1$
+        if (fCategory >= 0) {
+            LifelineCategories[] categories = fFrame.getLifelineCategories();
+            if (fCategory < categories.length) {
+                return categories[fCategory].getName() + " " + getName(); //$NON-NLS-1$
+            }
+        }
+        return ""; //$NON-NLS-1$
     }
 
     /**
      * Returns the index of the first visible Execution Occurrence in the execution occurrence array.<br>
      * Execution Occurrences are Y ordered in this array
-     * 
+     *
      * @return the first visible Execution Occurrence
      */
     public int getExecOccurrenceDrawIndex() {
-        if (!hasChilden)
-            return 0;
-        if (indexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG) != null)
-            return ((Integer) indexes.get(BasicExecutionOccurrence.EXEC_OCC_TAG)).intValue();
-        else
+        if (!hasChildren()) {
             return 0;
+        }
+        if (getIndexes().get(BasicExecutionOccurrence.EXEC_OCC_TAG) != null) {
+            return getIndexes().get(BasicExecutionOccurrence.EXEC_OCC_TAG).intValue();
+        }
+        return 0;
     }
 
     /**
      * Set the frame on which this lifeline must be drawn
-     * 
+     *
      * @param parentFrame
+     *            Parent frame
      */
     protected void setFrame(Frame parentFrame) {
-        frame = parentFrame;
-        if (hasTime) {
-            frame.setHasTimeInfo(true);
+        fFrame = parentFrame;
+        if (fHasTimeInfo) {
+            fFrame.setHasTimeInfo(true);
+        }
+        if (fFrame.getMaxEventOccurrence() < getEventOccurrence() + 1) {
+            fFrame.setMaxEventOccurrence(getEventOccurrence() + 1);
         }
-        if (frame.getMaxEventOccurrence() < getEventOccurrence() + 1)
-            frame.setMaxEventOccurrence(getEventOccurrence() + 1);
     }
 
     /**
      * Returns the frame which this lifeline is drawn
-     * 
+     *
      * @return the Frame
      */
     protected Frame getFrame() {
-        return frame;
+        return fFrame;
     }
 
     /**
      * Set the lifeline position index in the containing frame
-     * 
+     *
      * @param index the lifeline X position
      */
-
     protected void setIndex(int index) {
-        indexInFrame = index;
+        fIndexInFrame = index;
     }
 
     /**
      * Returns the lifeline position in de the containing frame
-     * 
+     *
      * @return the X position
      */
     public int getIndex() {
-        return indexInFrame;
+        return fIndexInFrame;
     }
 
     /**
@@ -169,86 +202,96 @@ public class Lifeline extends GraphNode {
      * greater event created on this lifeline are still valid and usable. This also need to inform the frame of the
      * operation mostly to store in the frame the greater event found in the diagram (used to determine the frame
      * height)
-     * 
+     *
      * @param eventOcc the new current event occurrence
      */
     public void setCurrentEventOccurrence(int eventOcc) {
-        if ((frame != null) && (frame.getMaxEventOccurrence() < eventOcc))
-            frame.setMaxEventOccurrence(eventOcc);
-        eventOccurrence = eventOcc;
+        if ((fFrame != null) && (fFrame.getMaxEventOccurrence() < eventOcc)) {
+            fFrame.setMaxEventOccurrence(eventOcc);
+        }
+        fEventOccurrence = eventOcc;
     }
 
     /**
      * Returns the last created event occurrence along the lifeline.
-     * 
+     *
      * @return the current event occurrence
      */
     public int getEventOccurrence() {
-        return eventOccurrence;
+        return fEventOccurrence;
     }
 
     /**
      * Creates a new event occurrence along the lifeline.
-     * 
+     *
      * @return the new created event occurrence
      */
     public int getNewEventOccurrence() {
-        setCurrentEventOccurrence(eventOccurrence + 1);
-        return eventOccurrence;
+        setCurrentEventOccurrence(fEventOccurrence + 1);
+        return fEventOccurrence;
     }
 
     /**
      * Adds the execution occurrence given in parameter to the lifeline.<br>
      * A Execution occurrence is never drawn in the frame instead it is added to a lifeline
-     * 
+     *
      * @param exec the execution occurrence to add
      */
     public void addExecution(BasicExecutionOccurrence exec) {
         exec.setLifeline(this);
         addNode(exec);
-        if ((frame != null) && (frame.getMaxEventOccurrence() < exec.endEventOccurrence))
-            frame.setMaxEventOccurrence(exec.endEventOccurrence);
+        if ((fFrame != null) && (fFrame.getMaxEventOccurrence() < exec.getEndOccurrence())) {
+            fFrame.setMaxEventOccurrence(exec.getEndOccurrence());
+        }
     }
 
+    /**
+     * Set whether lifeline has time information available or not.
+     * @param value The value to set
+     */
     protected void setTimeInfo(boolean value) {
-        hasTime = value;
-        if ((frame != null) && (value == true))
-            frame.setHasTimeInfo(value);
+        fHasTimeInfo = value;
+        if ((fFrame != null) && value) {
+            fFrame.setHasTimeInfo(value);
+        }
     }
 
     /**
+     * Returns true if at least one execution occurrence has time info.
+     *
      * @return true if at least one execution occurrence has time info
      */
     public boolean hasTimeInfo() {
-        return hasTime;
+        return fHasTimeInfo;
     }
 
     /**
-     * Returns the list of execution occurrence on this lifeline
-     * 
+     * Returns the list of execution occurrence on this lifeline.
+     *
      * @return the execution occurrence list
      */
     public List<GraphNode> getExecutions() {
-        if (hasChilden)
-            return (List<GraphNode>) nodes.get(BasicExecutionOccurrence.EXEC_OCC_TAG);
-        else
-            return new ArrayList<GraphNode>();
+        if (hasChildren()) {
+            return getNodeMap().get(BasicExecutionOccurrence.EXEC_OCC_TAG);
+        }
+        return new ArrayList<>();
     }
 
     @Override
-    public boolean contains(int _x, int _y) {
+    public boolean contains(int xValue, int yValue) {
         int x = getX();
         int y = getY();
         int width = getWidth();
         int height = getHeight();
 
-        if (frame == null)
+        if (fFrame == null) {
             return false;
-        if (Frame.contains(x, y, width, height, _x, _y)) {
+        }
+        if (GraphNode.contains(x, y, width, height, xValue, yValue)) {
             return true;
         }
-        if (Frame.contains(x + Metrics.getLifelineWidth() / 2 - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2, y + height, Metrics.EXECUTION_OCCURRENCE_WIDTH, (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * frame.getMaxEventOccurrence()
-                + Metrics.LIFELINE_VB_MAGIN - 4, _x, _y)) {
+        if (GraphNode.contains(x + Metrics.getLifelineWidth() / 2 - Metrics.EXECUTION_OCCURRENCE_WIDTH / 2, y + height, Metrics.EXECUTION_OCCURRENCE_WIDTH, (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fFrame.getMaxEventOccurrence()
+                + Metrics.LIFELINE_VB_MAGIN - 4, xValue, yValue)) {
             return true;
         }
 
@@ -256,113 +299,130 @@ public class Lifeline extends GraphNode {
         int hMargin = (Metrics.LIFELINE_VT_MAGIN - height) / 2;
 
         if (hMargin >= 2) {
-            if (frame.getVisibleAreaY() < y - height - hMargin) {
-                if (Frame.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height + 1, _x, _y))
+            if (fFrame.getVisibleAreaY() < y - height - hMargin) {
+                if (GraphNode.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height + 1, xValue, yValue)) {
                     return true;
+                }
             } else {
-                if (Frame.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, frame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height, _x, _y))
+                if (GraphNode.contains(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height, xValue, yValue)) {
                     return true;
+                }
             }
         }
-        if (getNodeAt(_x, _y) != null)
+        if (getNodeAt(xValue, yValue) != null) {
             return true;
+        }
         return false;
     }
 
     /**
      * Returns the lifeline visibility for the given visible area
-     * 
-     * @param vx
-     * @param vy
-     * @param vwidth
-     * @param vheight
+     *
+     * @param vx The x coordinate of the visible area
+     * @param vy The y coordinate of the visible area
+     * @param vwidth The width of the visible area
+     * @param vheight The height of the visible area
      * @return true if visible false otherwise
      */
     @Override
     public boolean isVisible(int vx, int vy, int vwidth, int vheight) {
         int x = getX();
         int width = getWidth();
-        if (((x >= vx) && (x <= vx + vwidth)) || ((x + width >= vx) && (x <= vx)))
+        if (((x >= vx) && (x <= vx + vwidth)) || ((x + width >= vx) && (x <= vx))) {
             return true;
+        }
         return false;
     }
 
+    /**
+     * Draws the name within the graphical context.
+     *
+     * @param context The graphical context.
+     */
     protected void drawName(IGC context) {
+        ISDPreferences pref = SDViewPref.getInstance();
+
         int x = getX();
         int y = getY();
         int height = Metrics.getLifelineHeaderFontHeigth() + 2 * Metrics.LIFELINE_HEARDER_TEXT_V_MARGIN;
         int hMargin = Metrics.LIFELINE_VT_MAGIN / 4;// (Metrics.LIFELINE_NAME_H_MARGIN)/2;
 
         context.setLineStyle(context.getLineSolidStyle());
-        context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER));
-        context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE_HEADER));
-        context.setFont(Frame.getUserPref().getFont(ISDPreferences.PREF_LIFELINE_HEADER));
+        context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER));
+        context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE_HEADER));
+        context.setFont(pref.getFont(ISDPreferences.PREF_LIFELINE_HEADER));
         if (hMargin >= 0) {
-            if (frame.getVisibleAreaY() < y - height - hMargin) {
+            if (fFrame.getVisibleAreaY() < y - height - hMargin) {
                 context.fillRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height);
                 context.drawRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2, height);
-                context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_LIFELINE_HEADER));
+                context.setForeground(pref.getFontColor(ISDPreferences.PREF_LIFELINE_HEADER));
                 context.drawTextTruncatedCentred(getName(), x + Metrics.LIFELINE_NAME_V_MARGIN - Metrics.LIFELINE_SPACING / 2 + 1, y - height - hMargin, Metrics.swimmingLaneWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN - 2, height, true);
             } else {
-                context.fillRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, frame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height);
-                context.drawRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, frame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height);
-                context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_LIFELINE_HEADER));
-                context.drawTextTruncatedCentred(getName(), x - Metrics.LIFELINE_SPACING / 2 + Metrics.LIFELINE_NAME_V_MARGIN + 1, frame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN - 2, height, true);
+                context.fillRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height);
+                context.drawRectangle(x - Metrics.LIFELINE_SPACING / 2 + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2, height);
+                context.setForeground(pref.getFontColor(ISDPreferences.PREF_LIFELINE_HEADER));
+                context.drawTextTruncatedCentred(getName(), x - Metrics.LIFELINE_SPACING / 2 + Metrics.LIFELINE_NAME_V_MARGIN + 1, fFrame.getVisibleAreaY(), Metrics.swimmingLaneWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN - 2, height, true);
             }
         }
     }
 
     /**
      * Force the lifeline to be drawn at the given coordinate
-     * 
+     *
      * @param context - the context to draw into
      * @param x - the x coordinate
      * @param y - the y coordinate
      */
     public void draw(IGC context, int x, int y) {
+
+        ISDPreferences pref = SDViewPref.getInstance();
+
         // Set the draw color depending if the lifeline must be selected or not
         context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
         if (isSelected()) {
-            if (Frame.getUserPref().useGradienColor()) {
-                context.setGradientColor(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE));
+            if (pref.useGradienColor()) {
+                context.setGradientColor(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE));
             }
-            context.setBackground(Frame.getUserPref().getBackGroundColorSelection());
-            context.setForeground(Frame.getUserPref().getForeGroundColorSelection());
+            context.setBackground(pref.getBackGroundColorSelection());
+            context.setForeground(pref.getForeGroundColorSelection());
         } else {
-            if (Frame.getUserPref().useGradienColor()) {
-                context.setGradientColor(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE));
-                context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_FRAME));
-            } else
-                context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE));
-            context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE));
+            if (pref.useGradienColor()) {
+                context.setGradientColor(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE));
+                context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_FRAME));
+            } else {
+                context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE));
+            }
+            context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE));
         }
         // Store the lifeline coordinates to save some calls
         int width = getWidth();
         int height = getHeight();
 
         // Draw the rectangle which contain the lifeline name
-        if (Frame.getUserPref().useGradienColor()) {
+        if (pref.useGradienColor()) {
             context.fillGradientRectangle(x, y, width, height / 2 - 7, true);
             context.fillRectangle(x, y + height / 2 - 8, width, +height / 2 - 5);
             context.fillGradientRectangle(x, y + height, width, -height / 2 + 6, true);
-        } else
+        } else {
             context.fillRectangle(x, y, width, height);
+        }
         context.drawRectangle(x, y, width, height);
 
-        if (category >= 0) {
-            LifelineCategories[] categories = frame.getLifelineCategories();
-            if (category < categories.length) {
-                IImage image = categories[category].getImage();
-                if (image != null)
+        if (fCategory >= 0) {
+            LifelineCategories[] categories = fFrame.getLifelineCategories();
+            if (fCategory < categories.length) {
+                IImage image = categories[fCategory].getImage();
+                if (image != null) {
                     context.drawImage(image, x, y, width, height);
+                }
             }
         }
 
         // Draw the lifeline label into the rectangle
         // The label is truncated if it cannot fit
         IColor temp = context.getForeground();
-        context.setFont(Frame.getUserPref().getFont(ISDPreferences.PREF_LIFELINE));
-        context.setForeground(Frame.getUserPref().getFontColor(ISDPreferences.PREF_LIFELINE));
+        context.setFont(pref.getFont(ISDPreferences.PREF_LIFELINE));
+        context.setForeground(pref.getFontColor(ISDPreferences.PREF_LIFELINE));
         context.drawTextTruncatedCentred(getName(), x + Metrics.LIFELINE_NAME_V_MARGIN, y, Metrics.getLifelineWidth() - 2 * Metrics.LIFELINE_NAME_V_MARGIN, height, true);
 
         context.setLineStyle(context.getLineDashStyle());
@@ -374,16 +434,16 @@ public class Lifeline extends GraphNode {
         // if there is no stop the line is drawn to the bottom of the frame
 
         // by default set the height to reach the frame bottom
-        int dashedLineEnd = y + height + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * frame.getMaxEventOccurrence() + Metrics.LIFELINE_VB_MAGIN;
+        int dashedLineEnd = y + height + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fFrame.getMaxEventOccurrence() + Metrics.LIFELINE_VB_MAGIN;
         /*
          * if (stop != null) { dashedLineEnd = stop.getY(); }
          */
 
         if (isSelected()) {
-            context.setForeground(Frame.getUserPref().getBackGroundColorSelection());
+            context.setForeground(pref.getBackGroundColorSelection());
             context.setLineWidth(5);
             context.drawLine(x + Metrics.getLifelineWidth() / 2, y + height, x + Metrics.getLifelineWidth() / 2, dashedLineEnd - 4);
-            context.setForeground(Frame.getUserPref().getForeGroundColorSelection());
+            context.setForeground(pref.getForeGroundColorSelection());
         }
 
         context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
@@ -393,15 +453,16 @@ public class Lifeline extends GraphNode {
 
         context.setLineStyle(context.getLineSolidStyle());
 
-        if (hasFocus())
+        if (hasFocus()) {
             drawFocus(context);
+        }
 
         super.drawChildenNodes(context);
     }
 
     /**
      * Draws the select execution occurrence region using the given color
-     * 
+     *
      * @param context the graphical context
      * @param startEvent the region start
      * @param nbEvent the region height
@@ -430,8 +491,9 @@ public class Lifeline extends GraphNode {
 
     @Override
     public boolean positiveDistanceToPoint(int x, int y) {
-        if (getX() > x - Metrics.swimmingLaneWidth())
+        if (getX() > x - Metrics.swimmingLaneWidth()) {
             return true;
+        }
         return false;
     }
 
@@ -442,25 +504,29 @@ public class Lifeline extends GraphNode {
         if (getFrame() != null) {
             vy = getFrame().getVisibleAreaY();
             vh = getFrame().getVisibleAreaHeight();
-        } else
+        } else {
             return null;
-        if (getExecutions() == null)
+        }
+        if (getExecutions() == null) {
             return null;
+        }
         for (int i = getExecOccurrenceDrawIndex(); i < getExecutions().size(); i++) {
-            GraphNode node = (GraphNode) getExecutions().get(i);
+            GraphNode node = getExecutions().get(i);
             if (node.getHeight() < 0) {
-                if (node.getY() + node.getHeight() > vy + vh)
+                if (node.getY() + node.getHeight() > vy + vh) {
                     break;
+                }
             } else {
-                if (node.getY() > vy + vh)
+                if (node.getY() > vy + vh) {
                     break;
+                }
             }
             if (node.contains(x, y)) {
                 GraphNode internal = node.getNodeAt(x, y);
-                if (internal != null)
+                if (internal != null) {
                     return internal;
-                else
-                    return node;
+                }
+                return node;
             }
         }
         return null;
This page took 0.040842 seconds and 5 git commands to generate.