package bk; import javax.swing.JTree; import animation.AlgorithmStage; import animation.AnimatedAlgorithm; import animation.CodeLine; import animation.ControlFlow; import animation.Memory; import animation.PseudoCodeNode; import graph.LayeredGraphNode; import lib.TextLayoutHelper; /** * The stage of the BK node placement algorithm where the blocks are computed. * @author kolja * */ 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 ""; } }