svn commit: r16403 - trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-12-21 09:52:04-0800
New Revision: 16403

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java

Log:
Clean up Javadoc and warnings.  No functional change.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java?view=diff&pathrev=16403&r1=16402&r2=16403
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java	2008-12-21 09:52:04-0800
@@ -31,7 +31,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.TreeSet;
-import java.util.Vector;
 
 import org.apache.log4j.Logger;
 import org.argouml.uml.diagram.ArgoDiagram;
@@ -247,36 +246,31 @@
     }
 
     /**
-     * Constant value for the gap between edges.
+     * Gap to be left between edges.
      */
     private static final int E_GAP = 5;
 
     /**
-     * Constant value for the horizontal gap between nodes.
+     * Horizontal gap between nodes.
      */
     private static final int H_GAP = 80;
 
-    /**
-     * Logger for logging events.
-     */
     private static final Logger LOG =
 	Logger.getLogger(ClassdiagramLayouter.class);
 
     /**
-     * Constant value for the maximum row width.
+     * The maximum row width.
      */
     // TODO: this should be a configurable property
     private static final int MAX_ROW_WIDTH = 1200;
 
     /**
-     * Constant value for the vertical gap between nodes.
+     * Vertical gap between nodes.
      */
     private static final int V_GAP = 80;
 
-    // Attributes
-
     /**
-     * The diagram that will be layouted.
+     * The diagram that is being laid out.
      */
     private ArgoDiagram diagram;
 
@@ -300,23 +294,23 @@
             new ArrayList<ClassdiagramEdge>();
 
     /**
-     * Attribute layoutedObjects holds the objects to layout.
+     * List of objects to lay out.
      */
     private List<LayoutedObject> layoutedObjects =
             new ArrayList<LayoutedObject>();
 
     /**
-     * nodeRows contains all DiagramRows of the diagram.
+     * List of NodeRows in the diagram.
      */
     private List<NodeRow> nodeRows = new ArrayList<NodeRow>();
 
     /**
-     * internal.
+     * Base X position to use a starting point for next node.
      */
     private int xPos;
 
     /**
-     * internal.
+     * Base Y position for the row currently being laid out.
      */
     private int yPos;
 
@@ -328,9 +322,7 @@
      */
     public ClassdiagramLayouter(ArgoDiagram theDiagram) {
         diagram = theDiagram;
-        Iterator<Fig> nodeIter = diagram.getLayer().getContents().iterator();
-        while (nodeIter.hasNext()) {
-            Fig fig = nodeIter.next();
+        for (Fig fig : diagram.getLayer().getContents()) {
             if (fig.getEnclosingFig() == null) {
                 add(ClassdiagramModelElementFactory.SINGLETON.getInstance(fig));
             }
@@ -362,9 +354,8 @@
     }
 
     /**
-     * Operation getMinimumDiagramSize returns the minimum diagram size after
-     * the layout process.
-     *
+     * Return the minimum diagram size after the layout process.
+     * 
      * @return The minimum diagram size after the layout process.
      */
     public Dimension getMinimumDiagramSize() {
@@ -385,8 +376,7 @@
     }
 
     /**
-     * Operation getObject returns a object with a given index from the
-     * layouter.
+     * Return the object with a given index from the layouter.
      *
      * @param index
      *            represents the index of this object in the layouter.
@@ -397,7 +387,7 @@
     }
 
     /**
-     * Operation getObjects returns all the objects currently participating in
+     * Return all the objects currently participating in
      * the layout process.
      *
      * @return An array holding all the object in the layouter.
@@ -416,7 +406,7 @@
     }
 
     /**
-     * Operation layout implements the actual layout algorithm.
+     * Lay out the current diagram.
      */
     public void layout() {
         long s = System.currentTimeMillis();
@@ -470,9 +460,11 @@
                     + " Position: (" + xPosNew + "," + yPos + ") xPos: " 
                     + xPos + " hint: " + node.getPlacementHint());
         }
-        if (downlinks.size() == 1
-                && downlinks.get(0).getUpNodes().get(0).equals(node)) {
-            downlinks.get(0).setPlacementHint(xPosNew);
+        if (downlinks.size() == 1) {
+            ClassdiagramNode downNode = downlinks.get(0);
+            if (downNode.getUpNodes().get(0).equals(node)) {
+                downNode.setPlacementHint(xPosNew);
+            }
         }
         xPos = (int) Math.max(node.getPlacementHint() + curW, xPos + xOffset);
     }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=989055

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.