|
@@ -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;
|