浏览代码

Debug info und Knoten Selection

Kolja Strohm 6 年之前
父节点
当前提交
381bd2197c

+ 0 - 7
src/animation/AlgorithmStage.java

@@ -25,11 +25,4 @@ public interface AlgorithmStage {
      * @return The node.
      */
     public PseudoCodeNode createPseudocodeTree( JTree tree );
-    
-    /**
-     * Writes the state of the variables used in this stage to a pretty table.
-     * This table should also render nicely if interpreted as markdown. 
-     * @return the table
-     */
-    public String getDebugString();
 }

+ 7 - 0
src/animation/AnimatedAlgorithm.java

@@ -87,4 +87,11 @@ public abstract class AnimatedAlgorithm extends Thread implements AlgorithmStage
 
     @Override
     public abstract PseudoCodeNode createPseudocodeTree( JTree tree );
+    
+    public String getDebugString()
+    {
+        if( processor == null )
+            return "";
+        return processor.getDebugOutput();
+    }
 }

+ 8 - 3
src/animation/PseudoCodeNode.java

@@ -25,16 +25,14 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
     private static int nextNodeId = 0;
     private final int nodeId;
     private AnimationController controller;
-    private AnimatedAlgorithm alg;
     private JTree tree;
     private CodeLine code;
     private boolean selected;
     private boolean breakPoint;
     
-    public PseudoCodeNode( String description, JTree tree, CodeLine line, AnimatedAlgorithm alg )
+    public PseudoCodeNode( String description, JTree tree, CodeLine line )
     {
         super( description );
-        this.alg = alg;
         synchronized( PseudoCodeNode.class )
         {
         	nodeId = nextNodeId++;
@@ -180,4 +178,11 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
     {
         return code.runBackward( m );
     }
+    
+    public String getDebugOutput( Memory m )
+    {
+        if( parent == null )
+            return "";
+        return ((PseudoCodeNode)parent).getDebugOutput( m );
+    }
 }

+ 9 - 0
src/animation/PseudoCodeProcessor.java

@@ -12,6 +12,7 @@ public class PseudoCodeProcessor {
         FINISHED
     }
     
+    private String currentDebugOutput;
     private Memory mem;
     private PseudoCodeNode programPointer;
     
@@ -20,6 +21,7 @@ public class PseudoCodeProcessor {
         mem = new Memory();
         mem.addFrame( new StackFrame( FrameType.FUNCTION ) );
         programPointer = tree;
+        currentDebugOutput = "";
     }
     
     private CodeStatus selectNextNode( PseudoCodeNode next, PseudoCodeNode last )
@@ -45,6 +47,7 @@ public class PseudoCodeProcessor {
         StackFrame before = mem.removeFrame();
         mem.addFrame( before );
         ControlFlow cf = programPointer.forwardStep( mem );
+        currentDebugOutput = programPointer.getDebugOutput( mem );
         switch( cf.getStatus() )
         {
         case ControlFlow.STEP_INTO:
@@ -125,6 +128,7 @@ public class PseudoCodeProcessor {
         StackFrame before = mem.removeFrame();
         mem.addFrame( before );
         ControlFlow cf = programPointer.backwardStep( mem );
+        currentDebugOutput = programPointer.getDebugOutput( mem );
         switch( cf.getStatus() )
         {
         case ControlFlow.STEP_INTO:
@@ -181,4 +185,9 @@ public class PseudoCodeProcessor {
         } while( mem.getSize() >= stackSize && status == CodeStatus.UNFINISHED );
         return status;
     }
+    
+    public String getDebugOutput()
+    {
+        return currentDebugOutput;
+    }
 }

+ 7 - 42
src/bk/BKNodePlacement.java

@@ -23,10 +23,6 @@ import lib.TextLayoutHelper;
  */
 public class BKNodePlacement extends AnimatedAlgorithm {
 
-    /*
-     * Private data structures to store the process of the algorithm
-     */
-
     public enum State
     {
         CONFLICTS,
@@ -36,22 +32,12 @@ public class BKNodePlacement extends AnimatedAlgorithm {
         LAYOUT4,
         COMBINE
     }
-
-    private ConflictDetection conftion;
+    
     private State state;
-    private ExtremalLayoutCalc layouts[];
-    private Combine combine;
-
+    
     public BKNodePlacement(AnimationController controller, LayeredGraphNode graph, JFrame view) {
         super(controller, graph, view);
         state = State.CONFLICTS;
-        conftion = new ConflictDetection( this );
-        layouts = new ExtremalLayoutCalc[ 4 ];
-        layouts[ 0 ] = new ExtremalLayoutCalc( this );
-        layouts[ 1 ] = new ExtremalLayoutCalc( this );
-        layouts[ 2 ] = new ExtremalLayoutCalc( this );
-        layouts[ 3 ] = new ExtremalLayoutCalc( this );
-        combine = new Combine( this );
     }
     
     public State getAlgorithmState()
@@ -59,7 +45,7 @@ public class BKNodePlacement extends AnimatedAlgorithm {
         return state;
     }
     
-    public void setState( State s )
+    public void setAlgorithmState( State s )
     {
         state = s;
     }
@@ -68,7 +54,7 @@ public class BKNodePlacement extends AnimatedAlgorithm {
     public PseudoCodeNode createPseudocodeTree( JTree tree )
     {
     	String[] vars = { "graph" };
-    	PseudoCodeNode mainFunction = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode("function bkNodePlacement( graph )", vars ), tree, new FunctionDefinition( new String[]{"graph"} ), this );
+    	PseudoCodeNode mainFunction = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode("function bkNodePlacement( graph )", vars ), tree, new FunctionDefinition( new String[]{"graph"} ) );
     	root = new PseudoCodeNode( TextLayoutHelper.setupPseudoCodeStage("-- BK Node Placement Algorithm --" ), tree, new CodeLine() {
 
 			@Override
@@ -88,36 +74,15 @@ public class BKNodePlacement extends AnimatedAlgorithm {
 				return new ControlFlow( mainFunction );
 			}
         	
-        }, this );
+        } );
         root.setSelected( true );
     	
-        PseudoCodeNode conflictDetectionFunction = conftion.createPseudocodeTree( tree );
-        PseudoCodeNode node1 = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "call detectConflicts( graph )", vars ), tree, new FunctionCall( conflictDetectionFunction, new String[]{ "graph" } ), this );
+        PseudoCodeNode conflictDetectionFunction = new ConflictDetection( this ).createPseudocodeTree( tree );
+        PseudoCodeNode node1 = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "call detectConflicts( graph )", vars ), tree, new FunctionCall( conflictDetectionFunction, new String[]{ "graph" } ) );
         root.add( mainFunction );
         mainFunction.add( node1 );
         root.add( conflictDetectionFunction );
         processor = new PseudoCodeProcessor( root );
         return root;
     }
-
-    @Override
-    public String getDebugString()
-    {
-        switch( state )
-        {
-        case CONFLICTS:
-            return conftion.getDebugString();
-        case LAYOUT1:
-            return layouts[ 0 ].getDebugString();
-        case LAYOUT2:
-            return layouts[ 1 ].getDebugString();
-        case LAYOUT3:
-            return layouts[ 2 ].getDebugString();
-        case LAYOUT4:
-            return layouts[ 3 ].getDebugString();
-        case COMBINE:
-            return combine.getDebugString();
-        }
-        return "";
-    }
 }

+ 1 - 16
src/bk/BlockCalc.java

@@ -18,32 +18,17 @@ import lib.TextLayoutHelper;
  */
 public class BlockCalc implements AlgorithmStage {
 
-    private AnimatedAlgorithm alg;
-
-    public BlockCalc( AnimatedAlgorithm alg  )
-    {
-        this.alg = alg;
-    }
-
     @Override
     public PseudoCodeNode createPseudocodeTree( JTree tree ) {
         String[] vars = { "graph", "L", "v", "r", "neighbors" };
         PseudoCodeNode root = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "calculateBlockGraph( graph )", vars ), tree, new CodeLine() {
-
-        	private LayeredGraphNode param;
         	
 			@Override
 			public ControlFlow runForward(Memory m) {
 				return new ControlFlow( ControlFlow.STEP_INTO );
 			}
         	
-        }, alg);
+        } );
         return root;
     }
-    
-    @Override
-    public String getDebugString()
-    {
-        return "";
-    }
 }

+ 1 - 17
src/bk/Combine.java

@@ -3,7 +3,6 @@ package bk;
 import javax.swing.JTree;
 
 import animation.AlgorithmStage;
-import animation.AnimatedAlgorithm;
 import animation.CodeLine;
 import animation.ControlFlow;
 import animation.Memory;
@@ -17,13 +16,6 @@ import lib.TextLayoutHelper;
  */
 public class Combine implements AlgorithmStage {
 
-    private AnimatedAlgorithm alg;
-
-    public Combine( AnimatedAlgorithm alg )
-    {
-        this.alg = alg;
-    }
-
     @Override
     public PseudoCodeNode createPseudocodeTree( JTree tree ) {
         PseudoCodeNode root = new PseudoCodeNode( TextLayoutHelper.setupPseudoCodeStage("Balancing"), tree, new CodeLine() {
@@ -34,15 +26,7 @@ public class Combine implements AlgorithmStage {
 				return null;
 			}
         	
-        }, alg );
+        } );
         return root;
     }
-    
-    @Override
-    public String getDebugString()
-    {
-        String info = "| Node |  x  | x LU | x RU | x LL | x RL |\n";
-        info +=       "|------|-----|------|------|------|------|\n";
-        return info;
-    }
 }

+ 2 - 17
src/bk/Compaction.java

@@ -3,7 +3,6 @@ package bk;
 import javax.swing.JTree;
 
 import animation.AlgorithmStage;
-import animation.AnimatedAlgorithm;
 import animation.CodeLine;
 import animation.ControlFlow;
 import animation.Memory;
@@ -15,15 +14,7 @@ import lib.TextLayoutHelper;
  * @author kolja
  *
  */
-public class Compaction implements AlgorithmStage{
-
-    private AnimatedAlgorithm alg;
-
-
-    public Compaction( AnimatedAlgorithm alg )
-    {
-        this.alg = alg;
-    }
+public class Compaction implements AlgorithmStage {
 
     @Override
     public PseudoCodeNode createPseudocodeTree( JTree tree ) {
@@ -34,13 +25,7 @@ public class Compaction implements AlgorithmStage{
 				return null;
 			}
         	
-        }, alg );
+        } );
         return root;
     }
-    
-    @Override
-    public String getDebugString()
-    {
-        return "";
-    }
 }

+ 62 - 68
src/bk/ConflictDetection.java

@@ -6,12 +6,12 @@ import java.util.List;
 import javax.swing.JTree;
 
 import animation.AlgorithmStage;
-import animation.AnimatedAlgorithm;
 import animation.CodeLine;
 import animation.ControlFlow;
 import animation.Memory;
 import animation.PseudoCodeNode;
 import animation.Memory.MemoryType;
+import bk.BKNodePlacement.State;
 import bk.ExtremalLayoutCalc.LayoutType;
 import codelines.DeclareVariable;
 import codelines.ForEachLoop;
@@ -34,23 +34,23 @@ import lib.TextLayoutHelper;
  */
 public class ConflictDetection implements AlgorithmStage {
 
-    private AnimatedAlgorithm alg;
-
-    public ConflictDetection( AnimatedAlgorithm alg ) {
-        this.alg = alg;
+    private BKNodePlacement alg;
+    
+    public ConflictDetection( BKNodePlacement bknpa )
+    {
+        alg = bknpa;
     }
-
+    
     @Override
     public PseudoCodeNode createPseudocodeTree(JTree tree) {
         String vars[] = { "i", "L", "k0", "l", "l1", "k1", "v", "graph", "n" };
         String params[] = { "graph" };
         @SuppressWarnings("serial")
-        PseudoCodeNode root = new PseudoCodeNode(TextLayoutHelper.setupPseudoCode("function mark_conflicts( graph )", vars), tree, new FunctionDefinition( params ), alg ) {
-            /*@Override
-            protected void hiddenActionWithoutSideEffects( Memory m )
+        PseudoCodeNode root = new PseudoCodeNode(TextLayoutHelper.setupPseudoCode("function mark_conflicts( graph )", vars), tree, new FunctionDefinition( params ) ) {
+            @Override
+            public String getDebugOutput( Memory m )
             {
-                ((BKNodePlacement)alg).setState( State.CONFLICTS );
-                
+                alg.setAlgorithmState( State.CONFLICTS );
                 if( m.isSomewhereDefined( "l", MemoryType.LOCAL ) && m.isSomewhereDefined( "i", MemoryType.LOCAL ) && 
                         m.<Integer>read( "l", MemoryType.LOCAL ) < m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).size() )
                     m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.<Integer>read( "i", MemoryType.LOCAL ) + 1).get(m.<Integer>read( "l", MemoryType.LOCAL )).setSelected(null);
@@ -74,27 +74,58 @@ public class ConflictDetection implements AlgorithmStage {
                 {
                     m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).setSelected( null );
                 }
-            }*/
+                String info = "| i  | l  | l1 | k0 | k1 |  v  |  n  |\n";
+                info +=       "|----|----|----|----|----|-----|-----|\n";
+                String i = "null";
+                String l = "null";
+                String l1 = "null";
+                String k0 = "null";
+                String k1 = "null";
+                String v = "null";
+                String n = "null";
+                if( m.isSomewhereDefined( "i", MemoryType.LOCAL ) )
+                    i = "" + m.<Integer>read( "i", MemoryType.LOCAL );
+                if( m.isSomewhereDefined( "l", MemoryType.LOCAL ) )
+                    l = "" + m.<Integer>read( "l", MemoryType.LOCAL );
+                if( m.isSomewhereDefined( "l1", MemoryType.LOCAL ) )
+                    l1 = "" + m.<Integer>read( "l1", MemoryType.LOCAL );
+                if( m.isSomewhereDefined( "k0", MemoryType.LOCAL ) )
+                    k0 = "" + m.<Integer>read( "k0", MemoryType.LOCAL );
+                if( m.isSomewhereDefined( "k1", MemoryType.LOCAL ) )
+                    k1 = "" + m.<Integer>read( "k1", MemoryType.LOCAL );
+                if( m.isSomewhereDefined( "v", MemoryType.LOCAL ) && m.<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ).getName() != null )
+                    v = "" + m.<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ).getName();
+                if( m.isSomewhereDefined( "n", MemoryType.LOCAL ) && m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getName() != null )
+                    n = "" + m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getName();
+                info += "|" + TextLayoutHelper.strToLen( i, 4 ) + 
+                        "|" + TextLayoutHelper.strToLen( l, 4 ) + 
+                        "|" + TextLayoutHelper.strToLen( l1, 4 ) + 
+                        "|" + TextLayoutHelper.strToLen( k0, 4 ) + 
+                        "|" + TextLayoutHelper.strToLen( k1, 4 ) + 
+                        "|" + TextLayoutHelper.strToLen( v, 5 ) + 
+                        "|" + TextLayoutHelper.strToLen( n, 5 ) + "|\n";
+                return info;
+            }
         };
-        PseudoCodeNode text = new PseudoCodeNode(TextLayoutHelper.setupPseudoCodeStage( "-- mark conflicts in subgrapfhs --" ), tree, new Kommentar(), alg );
+        PseudoCodeNode text = new PseudoCodeNode(TextLayoutHelper.setupPseudoCodeStage( "-- mark conflicts in subgrapfhs --" ), tree, new Kommentar() );
         root.add( text );
         PseudoCodeNode foreach = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "foreach n in graph.getContainedNodes() do", vars ), tree, new ForEachLoop<LayeredGraphNode>( "n" ) {
 			@Override
 			protected List<LayeredGraphNode> list(Memory m) {
 				return m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedNodes();
 			}
-        }, alg );
+        } );
         root.add( foreach );
         PseudoCodeNode ifNode = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if n has subgraph then", vars ), tree, new IfLoop() {
 			@Override
 			protected boolean condition(Memory m) {
 				return m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getContainedLayers().size() > 0;
 			}
-        }, alg );
+        } );
         foreach.add( ifNode );
-        PseudoCodeNode call = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "call mark_conflicts( n );", vars ), tree, new FunctionCall( root, new String[]{ "n" } ), alg );
+        PseudoCodeNode call = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "call mark_conflicts( n );", vars ), tree, new FunctionCall( root, new String[]{ "n" } ) );
         ifNode.add( call );
-        text = new PseudoCodeNode(TextLayoutHelper.setupPseudoCodeStage( "-- mark conflicts in graph --" ), tree, new Kommentar(), alg );
+        text = new PseudoCodeNode(TextLayoutHelper.setupPseudoCodeStage( "-- mark conflicts in graph --" ), tree, new Kommentar() );
         root.add( text );
         PseudoCodeNode init = new PseudoCodeNode(TextLayoutHelper.setupPseudoCode( "L = graph.getContainedLayers();", vars), tree, new CodeLine() {
 			@Override
@@ -106,7 +137,7 @@ public class ConflictDetection implements AlgorithmStage {
 				} );
 				return new ControlFlow( ControlFlow.STEP_OVER );
 			}
-        }, alg );
+        } );
         root.add( init );
         PseudoCodeNode outerLoop = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "for i=1 to |L|-2 do", vars ), tree, new ForLoop( "i" ) {
 			@Override
@@ -117,7 +148,7 @@ public class ConflictDetection implements AlgorithmStage {
 			protected int maximum( Memory m ) {
 				return m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).size() - 2;
 			}
-        }, alg );
+        } );
         root.add( outerLoop );
         PseudoCodeNode line = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k0 = 0; l = 0;", vars ), tree, new CodeLine() {
 			@Override
@@ -131,7 +162,7 @@ public class ConflictDetection implements AlgorithmStage {
 				} );
 				return new ControlFlow( ControlFlow.STEP_OVER );
 			}
-        }, alg );
+        } );
         outerLoop.add( line );
         PseudoCodeNode innerLoop = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "for l1=0 to |L[i+1]|-1 do", vars ), tree, new ForLoop( "l1" ) {
 			@Override
@@ -142,7 +173,7 @@ public class ConflictDetection implements AlgorithmStage {
 			protected int maximum(Memory m) {
 				return m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).size() - 1;
 			}
-        }, alg );
+        } );
         outerLoop.add( innerLoop );
         ifNode = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if l1==|L[i+1]|-1 or L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars ), tree, new IfLoop() {
 			@Override
@@ -150,21 +181,21 @@ public class ConflictDetection implements AlgorithmStage {
 	            return m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1).size() == m.<Integer>read( "l1", MemoryType.LOCAL ) || 
 	            		incidentToInnerSegmentBetweenLiPlusOneAndLi( m );
 			}
-        }, alg );
+        } );
         innerLoop.add( ifNode );
         line = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k1 = |L[i]|-1;", vars ), tree, new DeclareVariable<Integer>( "k1" ) {
 			@Override
 			protected Integer value(Memory m) {
 				return (int)m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).get( m.read( "i", MemoryType.LOCAL ) ).size() - 1;
 			}
-        }, alg );
+        } );
         ifNode.add( line );
         PseudoCodeNode innerIfNode = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars ), tree, new IfLoop() {
 			@Override
 			protected boolean condition(Memory m) {
 				return incidentToInnerSegmentBetweenLiPlusOneAndLi( m );
 			}
-		}, alg );
+		} );
         ifNode.add( innerIfNode );
         
         line = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k1 = pos(pred(L[i+1][l1])[0]);", vars ), tree, new SetVariable<Integer>( "k1" ) {
@@ -173,21 +204,21 @@ public class ConflictDetection implements AlgorithmStage {
 				return (int)m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.read( "i", MemoryType.LOCAL ) ).indexOf(
 						m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).get( m.read( "l1", MemoryType.LOCAL ) ).getSortedIncomingEdges().get( 0 ).getSources().get( 0 ) );
 			}
-        }, alg );
+        } );
         innerIfNode.add( line );
         PseudoCodeNode whileLoop = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "while l <= l1 do", vars ), tree, new WhileLoop() {
 			@Override
 			protected boolean condition( Memory m ) {
 				return m.<Integer>read( "l", MemoryType.LOCAL ) <= m.<Integer>read( "l1", MemoryType.LOCAL );
 			}
-        }, alg );
+        } );
         ifNode.add( whileLoop );
         foreach = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "foreach v in pred(L[i+1][l]) do", vars ), tree, new ForEachLoop<LayeredGraphEdge>( "v" ) {
 			@Override
 			protected List<LayeredGraphEdge> list(Memory m) {
 				return m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).get( m.read( "l", MemoryType.LOCAL ) ).getIncomingEdges();
 			}
-        }, alg );
+        } );
         whileLoop.add( foreach );
         innerIfNode = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if pos(v) < k0 or pos(v) > k1 then", vars ), tree, new IfLoop() {
 			@Override
@@ -195,7 +226,7 @@ public class ConflictDetection implements AlgorithmStage {
 			    int k = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.read( "i", MemoryType.LOCAL ) ).indexOf( m.<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ) );
 				return k < m.<Integer>read( "k0", MemoryType.LOCAL ) || k > m.<Integer>read( "k1", MemoryType.LOCAL );
 			}
-        }, alg );
+        } );
         foreach.add( innerIfNode );
         line = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "mark segment (v,L[i+1][l]);", vars ), tree, new CodeLine() {
 			@Override
@@ -209,21 +240,21 @@ public class ConflictDetection implements AlgorithmStage {
 				});
 				return new ControlFlow( ControlFlow.STEP_OVER );
 			}
-        }, alg );
+        } );
         innerIfNode.add( line );
         line = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "l = l+1;", vars ), tree, new SetVariable<Integer>( "l" ) {
 			@Override
 			protected Integer value(Memory m) {
 				return (int)m.<Integer>read( "l", MemoryType.LOCAL ) + 1;
 			}
-        }, alg );
+        } );
         whileLoop.add( line );
         line = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k0 = k1;", vars ), tree, new SetVariable<Integer>( "k0" ) {
 			@Override
 			protected Integer value(Memory m) {
 				return (int)m.<Integer>read( "l1", MemoryType.LOCAL );
 			}
-        }, alg );
+        } );
         ifNode.add( line );
         return root;
     }
@@ -237,41 +268,4 @@ public class ConflictDetection implements AlgorithmStage {
         }
         return false;
     }
-
-    @Override
-    public String getDebugString() {
-        String info = "| i  | l  | l1 | k0 | k1 |  v  |  n  |\n";
-        info +=       "|----|----|----|----|----|-----|-----|\n";
-        String i = "null";
-        String l = "null";
-        String l1 = "null";
-        String k0 = "null";
-        String k1 = "null";
-        String v = "null";
-        String n = "null";
-        /*
-        if( alg.getMemory().isSomewhereDefined( "i", MemoryType.LOCAL ) )
-            i = "" + alg.getMemory().<Integer>read( "i", MemoryType.LOCAL );
-        if( alg.getMemory().isSomewhereDefined( "l", MemoryType.LOCAL ) )
-            l = "" + alg.getMemory().<Integer>read( "l", MemoryType.LOCAL );
-        if( alg.getMemory().isSomewhereDefined( "l1", MemoryType.LOCAL ) )
-            l1 = "" + alg.getMemory().<Integer>read( "l1", MemoryType.LOCAL );
-        if( alg.getMemory().isSomewhereDefined( "k0", MemoryType.LOCAL ) )
-            k0 = "" + alg.getMemory().<Integer>read( "k0", MemoryType.LOCAL );
-        if( alg.getMemory().isSomewhereDefined( "k1", MemoryType.LOCAL ) )
-            k1 = "" + alg.getMemory().<Integer>read( "k1", MemoryType.LOCAL );
-        if( alg.getMemory().isSomewhereDefined( "v", MemoryType.LOCAL ) && alg.getMemory().<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ).getName() != null )
-            v = "" + alg.getMemory().<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ).getName();
-        if( alg.getMemory().isSomewhereDefined( "n", MemoryType.LOCAL ) && alg.getMemory().<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getName() != null )
-            n = "" + alg.getMemory().<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getName();*/
-        info += "|" + TextLayoutHelper.strToLen( i, 4 ) + 
-                "|" + TextLayoutHelper.strToLen( l, 4 ) + 
-                "|" + TextLayoutHelper.strToLen( l1, 4 ) + 
-                "|" + TextLayoutHelper.strToLen( k0, 4 ) + 
-                "|" + TextLayoutHelper.strToLen( k1, 4 ) + 
-                "|" + TextLayoutHelper.strToLen( v, 5 ) + 
-                "|" + TextLayoutHelper.strToLen( n, 5 ) + "|\n";
-        return info;
-    }
-
 }

+ 1 - 17
src/bk/ExtremalLayoutCalc.java

@@ -3,7 +3,6 @@ package bk;
 import javax.swing.JTree;
 
 import animation.AlgorithmStage;
-import animation.AnimatedAlgorithm;
 import animation.CodeLine;
 import animation.ControlFlow;
 import animation.Memory;
@@ -30,13 +29,6 @@ public class ExtremalLayoutCalc implements AlgorithmStage {
         BOTTOM_TOP_RIGHT,
         COMBINED
     }
-	
-    private AnimatedAlgorithm alg;
-
-    public ExtremalLayoutCalc( AnimatedAlgorithm alg )
-    {
-        this.alg = alg;
-    }
 
     @Override
     public PseudoCodeNode createPseudocodeTree( JTree tree ) {
@@ -48,15 +40,7 @@ public class ExtremalLayoutCalc implements AlgorithmStage {
 				return null;
 			}
     		
-    	}, alg );
+    	} );
         return root;
     }
-
-    @Override
-    public String getDebugString()
-    {
-        String info = "| Node | Shift | Sink | Root | Align |  x  |  xDef  |\n";
-        info +=       "|------|-------|------|------|-------|-----|--------|\n";
-        return info;
-    }
 }