Browse Source

move PseudoCodeNode to package view (and other small fixes)

Eren Yilmaz 6 years ago
parent
commit
630cdfce51

+ 1 - 0
src/animation/AlgorithmStage.java

@@ -3,6 +3,7 @@ package animation;
 import javax.swing.JTree;
 
 import bk.BlockCalc;
+import view.PseudoCodeNode;
 
 /**
  * Represents a specific stage of the algorithm.

+ 1 - 0
src/animation/AnimatedAlgorithm.java

@@ -8,6 +8,7 @@ import javax.swing.JTree;
 import javax.swing.SwingUtilities;
 
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 public abstract class AnimatedAlgorithm extends Thread implements AlgorithmStage {
 

+ 1 - 1
src/bk/BKNodePlacement.java

@@ -7,8 +7,8 @@ import javax.swing.JTree;
 
 import animation.AnimatedAlgorithm;
 import animation.AnimationController;
-import animation.PseudoCodeNode;
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 /**
  * The main stage of the BK node placement algorithm.

+ 1 - 1
src/bk/BlockCalc.java

@@ -8,10 +8,10 @@ import javax.swing.JTree;
 
 import animation.AlgorithmStage;
 import animation.BackwardAction;
-import animation.PseudoCodeNode;
 import bk.ExtremalLayoutCalc.LayoutType;
 import graph.LayeredGraphEdge;
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 /**
  * The stage of the BK node placement algorithm where the blocks are computed.

+ 1 - 1
src/bk/Combine.java

@@ -8,9 +8,9 @@ import javax.swing.JTree;
 
 import animation.AlgorithmStage;
 import animation.BackwardAction;
-import animation.PseudoCodeNode;
 import bk.ExtremalLayoutCalc.LayoutType;
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 /**
  * The stage of the combination of the four extremal layouts.

+ 1 - 1
src/bk/Compaction.java

@@ -6,9 +6,9 @@ import javax.swing.JTree;
 
 import animation.AlgorithmStage;
 import animation.BackwardAction;
-import animation.PseudoCodeNode;
 import bk.ExtremalLayoutCalc.LayoutType;
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 /**
  * The stage of compacting the layout.

+ 1 - 1
src/bk/ConflictDetection.java

@@ -6,9 +6,9 @@ import javax.swing.JTree;
 
 import animation.AlgorithmStage;
 import animation.BackwardAction;
-import animation.PseudoCodeNode;
 import graph.LayeredGraphEdge;
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 public class ConflictDetection implements AlgorithmStage {
 

+ 1 - 1
src/bk/ExtremalLayoutCalc.java

@@ -5,8 +5,8 @@ import java.lang.reflect.InvocationTargetException;
 import javax.swing.JTree;
 
 import animation.AlgorithmStage;
-import animation.PseudoCodeNode;
 import graph.LayeredGraphNode;
+import view.PseudoCodeNode;
 
 /**
  * The stage where the for extremal layouts are computed.

+ 0 - 1
src/view/MainView.java

@@ -39,7 +39,6 @@ import org.eclipse.elk.graph.ElkNode;
 
 import animation.Action;
 import animation.AnimationController;
-import animation.PseudoCodeNode;
 import bk.BKNodePlacement;
 import bk.ExtremalLayoutCalc.LayoutType;
 import graph.InitializeNodePositions;

+ 22 - 4
src/animation/PseudoCodeNode.java → src/view/PseudoCodeNode.java

@@ -1,15 +1,19 @@
-package animation;
+package view;
 
 import javax.swing.JTree;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.MutableTreeNode;
 import javax.swing.tree.TreePath;
 
+import animation.AnimationController;
+
+/**
+ * represents a line of pseudocode
+ * @author kolja
+ *
+ */
 public class PseudoCodeNode extends DefaultMutableTreeNode {
 
-    /**
-     * 
-     */
     private static final long serialVersionUID = 1L;
     
     private boolean selected;
@@ -54,6 +58,12 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         return selected;
     }
     
+    /**
+     * highlight this line of pseudocode.
+     * should be called when the line is entered, as it triggers breakpoints
+     * @param selected whether to select or deselect this line
+     * @return false iff a breakpoint was reached and the node was set to be selected.
+     */
     public boolean setSelected( boolean selected )
     {
         if( selected && breakPoint )
@@ -66,11 +76,19 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         return !breakPoint || !selected;
     }
     
+    /**
+     * set a breakpoint at this line of code
+     * @param breakPoint whether there should be a breakpoint or node
+     */
     public void setBreakPoint( boolean breakPoint )
     {
         this.breakPoint = breakPoint;
     }
     
+    /**
+     * check if there is a breakpoint set at this line of code
+     * @return true, iff there is a breakpoint
+     */
     public boolean hasBreakPoint()
     {
         return breakPoint;

+ 0 - 2
src/view/PseudoCodeRenderer.java

@@ -10,8 +10,6 @@ import javax.swing.JTree;
 import javax.swing.tree.DefaultTreeCellRenderer;
 import javax.swing.tree.TreeNode;
 
-import animation.PseudoCodeNode;
-
 /**
  * A tree-like display of pseudocode.
  * Extends {@link DefaultTreeCellRenderer}