Browse Source

jaaaaaaaavaaaaaaaaaaaaaaadocccccccccccc

Eren Yilmaz 6 years ago
parent
commit
887d79e7a2

+ 5 - 0
src/bk/BKNodePlacement.java

@@ -49,6 +49,11 @@ public class BKNodePlacement {
         return stage;
     }
 
+    /**
+     * creates the pseudo code for the whole bk node placement algorithm
+     * @param tree the tree where the code will be shown
+     * @return the root/starting point of the pseudo code
+     */
     public PseudoCodeNode createPseudocodeTree( JTree tree )
     {
     	String[] vars = { "layout", "graph" };

+ 2 - 2
src/codeline/AbstractForLoop.java

@@ -8,14 +8,14 @@ import processor.Memory.Visibility;
 import processor.StackFrame.FrameType;
 
 /**
- * the initial line of a for loop
+ * the initial line of a for loop "for (initialize; condition; step) do"
  * @author kolja
  *
  * @param <T> the type of the iteration variable
  */
 public abstract class AbstractForLoop<T> extends CodeLine {
 
-    String loopVar;
+    private String loopVar;
 
     public AbstractForLoop( String varName )
     {

+ 13 - 2
src/codeline/ForEachLoop.java

@@ -9,9 +9,15 @@ import processor.Memory.ReadOnlyMemory;
 import processor.Memory.Visibility;
 import processor.StackFrame.FrameType;
 
+/**
+ * the initial line of a for-each loop
+ * @author kolja
+ *
+ * @param <T> the type of the iteration variable
+ */
 public abstract class ForEachLoop <T> extends CodeLine {
 
-	String loopVar;
+    private String loopVar;
 	
 	public ForEachLoop( String varName )
 	{
@@ -67,5 +73,10 @@ public abstract class ForEachLoop <T> extends CodeLine {
 		return new ControlFlow( ControlFlow.STEP_INTO );
 	}
 	
-	abstract protected List<T> list( ReadOnlyMemory m );
+	/**
+	 * returns the list which the loop iterates through
+     * @param m the memory in which the variables are stored
+	 * @return the list
+	 */
+	protected abstract List<T> list( ReadOnlyMemory m );
 }

+ 20 - 4
src/codeline/ForLoop.java

@@ -7,9 +7,14 @@ import processor.Memory.ReadOnlyMemory;
 import processor.Memory.Visibility;
 import processor.StackFrame.FrameType;
 
+/**
+ * the initial line of a for loop of the kind "FOR x := min TO max DO"
+ * @author kolja
+ *
+ */
 public abstract class ForLoop extends CodeLine {
 
-	String loopVar;
+    private String loopVar;
 	
 	public ForLoop( String varName )
 	{
@@ -68,7 +73,18 @@ public abstract class ForLoop extends CodeLine {
 		return new ControlFlow( ControlFlow.STEP_INTO );
 	}
 	
-	abstract protected int minimum( ReadOnlyMemory m );
-	
-	abstract protected int maximum( ReadOnlyMemory m );
+	/**
+	 * returns the first value of the loop
+     * @param m the memory in which the variables are stored
+     * @return the starting value
+	 */
+	protected abstract int minimum( ReadOnlyMemory m );
+
+    
+    /**
+     * returns the last value of the loop, inclusively
+     * @param m the memory in which the variables are stored
+     * @return the last value
+     */
+	protected abstract int maximum( ReadOnlyMemory m );
 }

+ 4 - 0
src/codeline/FunctionCall.java

@@ -5,6 +5,10 @@ import processor.Memory;
 import processor.PseudoCodeNode;
 import processor.Memory.Visibility;
 
+/**
+ * a line of code that calls a function
+ * @author kolja
+ */
 public class FunctionCall extends CodeLine {
 
 	private PseudoCodeNode target;

+ 5 - 1
src/codeline/FunctionDefinition.java

@@ -6,6 +6,10 @@ import processor.StackFrame;
 import processor.Memory.Visibility;
 import processor.StackFrame.FrameType;
 
+/**
+ * a line of code that defines introduces the definition of a new function
+ * @author kolja
+ */
 public class FunctionDefinition extends CodeLine {
 
 	private String[] params;
@@ -22,7 +26,7 @@ public class FunctionDefinition extends CodeLine {
 			m.addFrame( new StackFrame( FrameType.FUNCTION ) );
 			m.declare( "line_" + lineId + "_inside", true, Visibility.LOCAL );
 			int index = 1;
-			Object olds[] = new Object[ params.length ];
+			Object[] olds = new Object[ params.length ];
 			for( String p : params )
 			{
 				olds[ index - 1 ] = m.read( "param" + index, Visibility.GLOBAL );

+ 6 - 1
src/codeline/IfLoop.java

@@ -40,5 +40,10 @@ public abstract class IfLoop extends CodeLine {
 		}
 	}
 
-	abstract protected boolean condition( ReadOnlyMemory m );
+    /**
+     * the exit condition of the loop
+     * @param m the memory in which the variables are stored
+     * @return false if the loop is over
+     */
+	protected abstract boolean condition( ReadOnlyMemory m );
 }

+ 14 - 2
src/codeline/SetVariable.java

@@ -5,6 +5,13 @@ import processor.Memory;
 import processor.Memory.ReadOnlyMemory;
 import processor.Memory.Visibility;
 
+/**
+ * sets the value of a previously declared variable.
+ * if the variable has not been declared, nothing happens.
+ * @author kolja
+ *
+ * @param <T> the type of the variable
+ */
 public abstract class SetVariable <T> extends CodeLine {
 
     private boolean oldExists;
@@ -29,6 +36,11 @@ public abstract class SetVariable <T> extends CodeLine {
         });
         return new ControlFlow( ControlFlow.STEP_OVER );
     }
-    
-    abstract protected T value( ReadOnlyMemory m );
+
+    /**
+     * returns the value that will be stored in the variable
+     * @param m the memory in which the variables are stored
+     * @return the value
+     */
+    protected abstract T value( ReadOnlyMemory m );
 }

+ 12 - 1
src/codeline/WhileLoop.java

@@ -7,6 +7,11 @@ import processor.Memory.ReadOnlyMemory;
 import processor.Memory.Visibility;
 import processor.StackFrame.FrameType;
 
+/**
+ * the initial line of a while loop of the kind "WHILE b DO s OD"
+ * @author kolja
+ *
+ */
 public abstract class WhileLoop extends CodeLine {
 
 	@Override
@@ -52,5 +57,11 @@ public abstract class WhileLoop extends CodeLine {
 		return new ControlFlow( ControlFlow.STEP_INTO );
 	}
 
-	abstract protected boolean condition( ReadOnlyMemory m );
+
+    /**
+     * the exit condition of the loop
+     * @param m the memory in which the variables are stored
+     * @return false if the loop is over
+     */
+	protected abstract boolean condition( ReadOnlyMemory  m );
 }

+ 8 - 1
src/graph/LayeredEdge.java

@@ -25,7 +25,14 @@ public class LayeredEdge implements LayeredGraphEdge {
     private boolean dummy;
     private ArrayList< Point >[] bindPoints;
     private boolean[] conflicted;
-    
+
+    /**
+     * creates a {@link LayeredEdge} from an {@link ElkEdge}.
+     * @param original the original {@link ElkEdge}.
+     * @param sources the sources of the edge.
+     * @param targets the targets of the edge.
+     * @param graph the graph containing the edge.
+     */
     @SuppressWarnings("unchecked")
     public LayeredEdge( ElkEdge original, ArrayList< LayeredGraphNode > sources, ArrayList< LayeredGraphNode > targets, LayeredGraphNode graph )
     {

+ 23 - 2
src/graph/LayeredGraphNode.java

@@ -260,9 +260,10 @@ public interface LayeredGraphNode {
 
   /**
    * Legt die X Koordinate des Knotens fest
-   * 
    * @param x
    *          die X Koordinate in Pixeln
+   * @param def whether the x coordinate is defined or not after setting the value
+   * @param layout the layout in which to set the coordinate
    */
   public void setX(double x, boolean def, LayoutType layout);
 
@@ -271,12 +272,14 @@ public interface LayeredGraphNode {
    * 
    * @param y
    *          die Y Koordinate in Pixeln
+   * @param layout the layout in which to set the coordinate
    */
   public void setY(double y, LayoutType layout);
 
   /**
    * Gibt die X Koordinate zur�ck
    * 
+   * @param layout the layout in which to get the coordinate
    * @return die X Koordinate in Pixeln zur�ck
    */
   public double getX(LayoutType layout);
@@ -284,6 +287,7 @@ public interface LayeredGraphNode {
   /**
    * Gibt die Y Koordinate zur�ck
    * 
+   * @param layout the layout in which to get the coordinate
    * @return die Y Koordinate in Pixeln zur�ck
    */
   public double getY(LayoutType layout);
@@ -291,6 +295,7 @@ public interface LayeredGraphNode {
   /**
    * Gibt die Breite des Knotens zur�ck
    * 
+   * @param layout the layout in which to get the width
    * @return die Breite in Pixeln
    */
   public double getWidth(LayoutType layout);
@@ -298,15 +303,26 @@ public interface LayeredGraphNode {
   /**
    * Gibt die H�he des Knotens zur�ck
    * 
+   * @param layout the layout in which to get the height
    * @return die H�he in Pixeln
    */
   public double getHeight(LayoutType layout);
 
+  /**
+   * sets the width of this node in the given layout
+   * @param w the width
+   * @param layout the layout
+   */
   public void setWidth(double w, LayoutType layout);
 
+  /**
+   * sets the height of this node in the given layout
+   * @param h the height
+   * @param layout the layout
+   */
   public void setHeight(double h, LayoutType layout);
 
-  // for subgraph
+  //------------------ for subgraph ------------------------------------------
 
   /**
    * Ermittelt den Index des Layers, dem ein Knoten angeh�rt
@@ -339,22 +355,27 @@ public interface LayeredGraphNode {
   public void setNodeLayer(LayeredGraphNode n, int index);
 
   /**
+   * Eine Liste mit allen Kanten des Subgraphen
    * @return Eine Liste mit allen Kanten des Subgraphen
    */
   public ArrayList<LayeredGraphEdge> getContainedEdges();
 
   /**
+   * Eine Liste mit allen Knoten des Subgraphen
    * @return Eine Liste mit allen Knoten des Subgraphen
    */
   public ArrayList<LayeredGraphNode> getContainedNodes();
 
   /**
+   * Eine Liste mit allen Knoten des Subgraphen sortiert nach Layern und
+   * Positionen
    * @return Eine Liste mit allen Knoten des Subgraphen sortiert nach Layern und
    *         Positionen
    */
   public ArrayList<LayeredGraphNode> getSortedContainedNodes();
 
   /**
+   * Eine Liste mit allen Layern des Subgraphen
    * @return Eine Liste mit allen Layern des Subgraphen
    */
   public ArrayList<ArrayList<LayeredGraphNode>> getContainedLayers();

+ 16 - 0
src/graph/LayeredNode.java

@@ -85,6 +85,11 @@ public class LayeredNode implements LayeredGraphNode {
         return ln;
     }
 
+    /**
+     * creates a {@link LayeredNode} from an {@link ElkNode}.
+     * @param original the original {@link ElkNode}.
+     * @param parent the graph containing the edge.
+     */
     public LayeredNode(ElkNode original, LayeredGraphNode parent) {
         this.original = original;
         this.parent = parent;
@@ -135,6 +140,11 @@ public class LayeredNode implements LayeredGraphNode {
         return mouseOver;
     }
 
+    /**
+     * associates the node with an {@link NodeView} in order to display it in the given layout.
+     * @param view the view
+     * @param layout the layout
+     */
     public void setView(NodeView view, LayoutType layout) {
         if (layout == LayoutType.LEFTMOST_UPPER)
             this.layouts[0].view = view;
@@ -148,6 +158,12 @@ public class LayeredNode implements LayeredGraphNode {
             this.combined.view = view;
     }
 
+
+    /**
+     * returns the {@link NodeView} of this node in the given layout.
+     * @param layout the layout
+     * @return the view
+     */
     public NodeView getView(LayoutType layout) {
         if (layout == LayoutType.LEFTMOST_UPPER)
             return layouts[0].view;

+ 1 - 0
src/graph/RandomGraphGenerator.java

@@ -43,6 +43,7 @@ public class RandomGraphGenerator {
      * creates a random {@link LayeredGraphNode} using the parameters given to the constructor of the {@link RandomGraphGenerator}
      * @param parent the parent node of the nodes in the graph
      * @param depth the current depth of the graph (used to check if the maximum depth is reached)
+     * @param prove whether to check if the graph is valid or to omit the check. true means check
      * @return the generated {@link LayeredGraphNode}
      */
     public LayeredGraphNode createRandomNode( LayeredGraphNode parent, int depth, boolean prove )

+ 16 - 0
src/lib/TextLayoutHelper.java

@@ -4,6 +4,11 @@ import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+/**
+ * helper methods for displaying text
+ * @author kolja
+ *
+ */
 public class TextLayoutHelper {
     /**
      * Modifies the given string such that its length matches the given length.
@@ -43,6 +48,12 @@ public class TextLayoutHelper {
         return "<html><font color=#FDD017>"+s+"</font></html>";
     }
     
+    /**
+     * syntax highlighting for pseudocode
+     * @param s the code
+     * @param vars a list of variable names
+     * @return the highlighted code
+     */
     public static String setupPseudoCode( String s, String[] vars )
     {
         if( s.startsWith( "--" ) )
@@ -63,6 +74,11 @@ public class TextLayoutHelper {
         return ret;
     }
 
+    /**
+     * searches a string for variable names
+     * @param s the string to search
+     * @return a list of variable names
+     */
     public static String[] getVariables( String s )
     {
         ArrayList<String> list = new ArrayList<>();

+ 5 - 0
src/processor/ControlFlow.java

@@ -2,6 +2,11 @@ package processor;
 
 import codeline.CodeLine.BackwardAction;
 
+/**
+ * specifies what should be done after executing a line of code.
+ * @author kolja
+ *
+ */
 public class ControlFlow {
     public static final int STEP_INTO = 0;
     public static final int STEP_OVER = 1;

+ 22 - 2
src/processor/Memory.java

@@ -142,11 +142,11 @@ public class Memory {
     }
     
     /**
-     * 
+     * reads the value of the variable from the memory
      * @param name the name of the variable
      * @param visibility visibility of the variable
      * @param <T> the type of the variable
-     * @return
+     * @return the value
      */
     public synchronized <T> T read( String name, Visibility visibility )
     {
@@ -177,7 +177,14 @@ public class Memory {
         }
         return null;
     }
+
     
+    /**
+     * checks if the variable is defined with respect to the given visibility
+     * @param name the name of the variable
+     * @param visibility the visibility
+     * @return true, if it is "somewhere defined"
+     */
     public synchronized boolean isSomewhereDefined( String name, Visibility visibility )
     {
         int index = stack.size() - 1;
@@ -207,6 +214,13 @@ public class Memory {
     	return false;
     }
     
+    /**
+     * checks if the variable is defined with respect to the given visibility.
+     * The difference to {@code isSomewhereDefined} is that even if COMPLETE_STACK is passed only the topmost frame is searched.
+     * @param name the name of the variable
+     * @param visibility the visibility
+     * @return true, if it is defined
+     */
     public synchronized boolean isDefined( String name, Visibility visibility )
     {
         switch( visibility )
@@ -224,6 +238,12 @@ public class Memory {
     	return false;
     }
     
+    
+    /**
+     * frees the storage of a variable by "undeclaring" it
+     * @param name the name of the variable
+     * @param visibility the visibility of the variable
+     */
     public synchronized void undeclare( String name, Visibility visibility )
     {
         switch( visibility )

+ 32 - 2
src/processor/PseudoCodeNode.java

@@ -19,6 +19,11 @@ import lib.TextLayoutHelper;
 public class PseudoCodeNode extends DefaultMutableTreeNode {
     private static final long serialVersionUID = 7366822030747482541L;
 
+    /**
+     * an action that can be performed after a step
+     * @author kolja
+     *
+     */
     public static enum CodeAction
     {
         SKIP,
@@ -34,6 +39,13 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
     private boolean selected;
     private boolean breakPoint;
     
+    /**
+     * creates a new line of pseudocode
+     * @param description the actual content of the line
+     * @param vars the variables used in this line
+     * @param tree the tree where to show this line
+     * @param line the executable {@link CodeLine} for this line
+     */
     public PseudoCodeNode( String description, String[] vars, JTree tree, CodeLine line )
     {
         super( TextLayoutHelper.setupPseudoCode( description, vars ) );
@@ -52,6 +64,10 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         return nodeId;
     }
     
+    /**
+     * assigns a controller to this line of code
+     * @param c the {@link ProcessController}
+     */
     public void setController( ProcessController c )
     {
         if( children != null )
@@ -72,7 +88,7 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
     }
     
     /**
-     * 
+     * returns the tree that this node belongs to
      * @return the tree that this node belongs to
      */
     public JTree getTree()
@@ -188,13 +204,22 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         return breakPoint;
     }
 
+    /**
+     * performs one forward step at this line
+     * @param m the memory in which the variables are stored
+     * @return what to do next
+     */
     public ControlFlow forwardStep( Memory m )
     {
         ControlFlow cf = code.runForward( m );
         cf.setJumpBack( this );
         return cf;
     }
-
+    /**
+     * performs an empty forwards step and makes it possible to undo this step (by doing nothing).
+     * @param m the memory in which the variables are stored
+     * @return what to do next
+     */
     public ControlFlow emptyForwardStep( Memory m )
     {
         code.createEmptyBackwardsAction();
@@ -208,6 +233,11 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         code.runBackward( m );
     }
 
+    /**
+     * return a debug string containing a table of variables and their values
+     * @param m the memory which contains the variables
+     * @return the table
+     */
     public String getDebugOutput( Memory m )
     {
         if( parent == null )

+ 27 - 0
src/processor/PseudoCodeProcessor.java

@@ -13,8 +13,19 @@ import graph.LayeredGraphNode;
 import processor.Memory.Visibility;
 import processor.StackFrame.FrameType;
 
+/**
+ * this class executes {@link CodeLine}s and manages the {@link Memory} for an algorithm
+ * @author kolja
+ *
+ */
 public class PseudoCodeProcessor extends Thread {
 
+    /**
+     * the state of the execution after a step has been done.
+     * for example BREAKPOINT indicates that a breakpoint has been reached.
+     * @author kolja
+     *
+     */
     public static enum CodeStatus
     {
         UNFINISHED,
@@ -32,6 +43,12 @@ public class PseudoCodeProcessor extends Thread {
     private JFrame view;
     private ProcessController controller;
     
+    /**
+     * creates a new {@link PseudoCodeProcessor}
+     * @param start the starting line of the algorithm
+     * @param graph the graph to work with
+     * @param view the view where to display the current state
+     */
     public PseudoCodeProcessor( PseudoCodeNode start, LayeredGraphNode graph, JFrame view )
     {
         mem = new Memory();
@@ -63,10 +80,16 @@ public class PseudoCodeProcessor extends Thread {
             return forwardStepOverUntilNotSkip();
         case STOP:
             return CodeStatus.BREAKPOINT;
+        default:
+            break;
         }
         return CodeStatus.UNFINISHED;
     }
     
+    /**
+     * perform one forward step of the algorithm assigned to this processor
+     * @return the status of execution after that step
+     */
     public CodeStatus forwardStep()
     {
         if( programPointer == null )
@@ -132,6 +155,8 @@ public class PseudoCodeProcessor extends Thread {
                 m.undeclare( name, Visibility.LOCAL );
             });
             return selectNextNode( f, programPointer );
+        default:
+            break;
         }
         throw new IllegalStateException( "Unknown ControlFlow action" );
     }
@@ -185,6 +210,8 @@ public class PseudoCodeProcessor extends Thread {
             return backwardStepOverUntilNotSkip();
         case STOP:
             return CodeStatus.BREAKPOINT;
+        default:
+            break;
         }
         return CodeStatus.UNFINISHED;
     }

+ 11 - 0
src/processor/StackFrame.java

@@ -2,8 +2,19 @@ package processor;
 
 import java.util.HashMap;
 
+/**
+ * a frame containing variables.
+ * can be used for storing variables and/or for pushing them to the stack.
+ * @author kolja
+ *
+ */
 public class StackFrame {
 
+    /**
+     * whether the frame belongs to a function or a loop.
+     * @author kolja
+     *
+     */
 	public enum FrameType {
 		FUNCTION,
 		LOOP

+ 15 - 0
src/view/AnimatedView.java

@@ -0,0 +1,15 @@
+package view;
+
+/**
+ * an object that can be displayed in the view.
+ * The main subclasses are {@link NodeView} and {@link EdgeView}.
+ * @author kolja
+ *
+ */
+public interface AnimatedView {
+
+    public int getVirtualX();
+    public int getVirtualY();
+    public int getVirtualWidth();
+    public int getVirtualHeight();
+}

+ 0 - 9
src/view/AnnimatedView.java

@@ -1,9 +0,0 @@
-package view;
-
-public interface AnnimatedView {
-
-    public int getVirtualX();
-    public int getVirtualY();
-    public int getVirtualWidth();
-    public int getVirtualHeight();
-}

+ 1 - 1
src/view/EdgeView.java

@@ -17,7 +17,7 @@ import graph.LayeredGraphEdge;
  * @author kolja
  *
  */
-public class EdgeView extends JPanel implements AnnimatedView {
+public class EdgeView extends JPanel implements AnimatedView {
     private static final long serialVersionUID = 1L;
 
     private LayeredGraphEdge model;

+ 5 - 0
src/view/LegendView.java

@@ -9,6 +9,11 @@ import java.awt.Graphics2D;
 
 import javax.swing.JPanel;
 
+/**
+ * displays a legend that describes the shapes and colors
+ * @author kolja
+ *
+ */
 public class LegendView extends JPanel {
 
 	private static final long serialVersionUID = 1L;

+ 6 - 0
src/view/MainView.java

@@ -663,6 +663,9 @@ public class MainView {
                     case COMBINE:
                         pl.add( combined );
                         break;
+                    default:
+                        assert false;
+                        break;
                     }
                     pl.revalidate();
                 }
@@ -727,6 +730,9 @@ public class MainView {
 	                case COMBINE:
 	                    pl.add( combined );
 	                    break;
+                    default:
+                        assert false;
+                        break;
 	                }
                 }
                 pl.revalidate();

+ 50 - 13
src/view/NodeView.java

@@ -24,7 +24,7 @@ import graph.LayeredGraphNode;
  * @author kolja
  *
  */
-public class NodeView extends JPanel implements AnnimatedView, MouseListener {
+public class NodeView extends JPanel implements AnimatedView, MouseListener {
     private static final long serialVersionUID = 1L;
     private LayeredGraphNode model;
     private LayoutType layout;
@@ -34,6 +34,12 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
     
     private static final int PADDING = 25;
 
+    /**
+     * creates a view for a given node
+     * @param model the node
+     * @param lt the layout in which to draw the node
+     * @param mv the frame in which to draw the layout
+     */
     public NodeView( LayeredGraphNode model, LayoutType lt, JFrame mv ) {
         mainView = mv;
         this.model = model;
@@ -65,6 +71,11 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         return (int)padding;
     }
     
+    /**
+     * returns the x coordinate that was scaled such that the whole image fits on the screen
+     * @param x the coordinate
+     * @return the coordinate
+     */
     public int getScaledX( int x )
     {
         int padding = calculatePadding();
@@ -72,7 +83,11 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         x *= scale;
         return x;
     }
-    
+    /**
+     * returns the y coordinate that was scaled such that the whole image fits on the screen
+     * @param y the coordinate
+     * @return the coordinate
+     */
     public int getScaledY( int y )
     {
         int padding = calculatePadding();
@@ -81,6 +96,9 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         return y;
     }
     
+    /**
+     * updates the text that is displayed when hovering over the node.
+     */
     public void updateTooltipText() {
         if( layout != LayoutType.COMBINED )
         {
@@ -104,6 +122,10 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         }
     }
 
+    /**
+     * returns the offset of the node
+     * @return the offset of the node
+     */
     public int getXOffset()
     {
         int x = 0;
@@ -112,7 +134,10 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         x += (getWidth()-padding) / 2 - (getWidthOfNeededArea() * scale ) / 2 + padding/2;
         return x;
     }
-
+    /**
+     * returns the offset of the node
+     * @return the offset of the node
+     */
     public int getYOffset()
     {
         int y = 0;
@@ -121,13 +146,21 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         y += (getHeight()-padding) / 2 - (getHeightOfNeededArea() * scale ) / 2 + padding/2;
         return y;
     }
-
+    
+    /**
+     * returns the original width of the node, before any scaling
+     * @return the width
+     */
     public int getOriginalWidth() {
     	if( model.isDummyNode() )
             return (int)(originalWidth / 3);
         return originalWidth;
     }
-
+    
+    /**
+     * returns the original height of the node, before any scaling
+     * @return the height
+     */
     public int getOriginalHeight() {
         return originalHeight;
     }
@@ -140,7 +173,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             if( c instanceof NodeView )
             {
                 max = Math.max( max, ((NodeView)c).getVirtualX() + ((NodeView)c).getOriginalWidth() );
-                min = Math.min( ((AnnimatedView)c).getVirtualX(), min);
+                min = Math.min( ((AnimatedView)c).getVirtualX(), min);
             }
         }
         return max - (int)min;
@@ -154,7 +187,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             if( c instanceof NodeView )
             {
                 max = Math.max( max, ((NodeView)c).getVirtualY() + ((NodeView)c).getOriginalHeight() );
-                min = Math.min( ((AnnimatedView)c).getVirtualY(), min);
+                min = Math.min( ((AnimatedView)c).getVirtualY(), min);
             }
         }
         return max - (int)min;
@@ -165,9 +198,9 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         double minX = Double.POSITIVE_INFINITY;
         for( Component c : getComponents() )
         {
-            if( !(c instanceof AnnimatedView) )
+            if( !(c instanceof AnimatedView) )
                 continue;
-            minX = Math.min( ((AnnimatedView)c).getVirtualX(), minX);
+            minX = Math.min( ((AnimatedView)c).getVirtualX(), minX);
         }
         int x = 0;
         int y = 0;
@@ -177,9 +210,9 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         y += (getHeight()) / 2 - (getHeightOfNeededArea() * scale ) / 2;
         for( Component c : getComponents() )
         {
-            if( !(c instanceof AnnimatedView) )
+            if( !(c instanceof AnimatedView) )
                 continue;
-            AnnimatedView view = (AnnimatedView)c;
+            AnimatedView view = (AnimatedView)c;
             if( c instanceof NodeView )
             {
                 c.setLocation( getScaledX( ((NodeView)c).getVirtualX() - (int)minX ) + x, getScaledY( view.getVirtualY() ) + y);
@@ -203,9 +236,9 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         double minX = Double.POSITIVE_INFINITY;
         for( Component c : getComponents() )
         {
-            if( !(c instanceof AnnimatedView) )
+            if( !(c instanceof AnimatedView) )
                 continue;
-            minX = Math.min( ((AnnimatedView)c).getVirtualX(), minX);
+            minX = Math.min( ((AnimatedView)c).getVirtualX(), minX);
         }
         int x = 0;
         int padding = calculatePadding();
@@ -226,6 +259,10 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         paintComponent( g );
     }
 
+    /**
+     * draws a background in the color of this nodes class around it
+     * @param g where to draw
+     */
     public void renderClass( Graphics g ) {
         g.setColor( model.getRoot( layout ).getClassColor( layout ) );
         if( model.getContainedNodes().size() == 0 && model.getRoot( layout ).getClassColor( layout ) != Color.LIGHT_GRAY )

+ 10 - 1
src/view/NumberDocumentListener.java

@@ -6,8 +6,17 @@ import javax.swing.JTextField;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 
+/**
+ * colorizes text field that require numbers in red if the entered value is not a number
+ * @author kolja
+ *
+ */
 public class NumberDocumentListener implements DocumentListener {
-    
+    /**
+     * will be executed whenever the value changes
+     * @author kolja
+     *
+     */
     public interface Action{
         public void action( int val );
     }

+ 5 - 0
src/view/OptionsDialog.java

@@ -12,6 +12,11 @@ import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JTextField;
 
+/**
+ * the "preferences" dialog
+ * @author kolja
+ *
+ */
 public class OptionsDialog extends JDialog {
 
     private static final long serialVersionUID = 1L;

+ 1 - 0
src/view/PseudoCodeLines.java

@@ -40,6 +40,7 @@ public class PseudoCodeLines extends JComponent implements MouseListener{
     
     /**
      * Constructs a new Component with no model
+     * @param t the tree where to draw
      */
     public PseudoCodeLines( JTree t ){
         super();

+ 8 - 0
src/view/RandomGraphDialog.java

@@ -21,6 +21,11 @@ import graph.RandomGraphGenerator;
 import lib.SimpleNodePlacement;
 import lib.SweepCrossingMinimizer;
 
+/**
+ * the "create random graph" dialog
+ * @author kolja
+ *
+ */
 public class RandomGraphDialog extends JDialog {
     
     private static final long serialVersionUID = 1L;
@@ -33,6 +38,9 @@ public class RandomGraphDialog extends JDialog {
     private JTextField maxNodes;
     private JTextField maxDepth;
     
+    /**
+     * creates the dialog
+     */
     public RandomGraphDialog()
     {
         setTitle( "Generate random graph" );