|
@@ -88,60 +88,30 @@ public class BKNodePlacement extends AnimatedAlgorithm {
|
|
|
protected String value(ReadOnlyMemory m) {
|
|
|
return "DOWN_RIGHT";
|
|
|
}
|
|
|
- }) {
|
|
|
- @Override
|
|
|
- public String getDebugOutput( Memory m ) {
|
|
|
- state = State.LAYOUT1;
|
|
|
- return super.getDebugOutput( m );
|
|
|
- }
|
|
|
- } );
|
|
|
+ }) );
|
|
|
mainFunction.add( new PseudoCodeNode( "call calcLayout( layout, graph )", vars, tree, new FunctionCall( calcLayout, new String[]{ "layout", "graph" } ) ) );
|
|
|
mainFunction.add( new PseudoCodeNode( "layout = 'DOWN_LEFT'", vars, tree, new SetVariable<String>( "layout" ) {
|
|
|
@Override
|
|
|
protected String value(ReadOnlyMemory m) {
|
|
|
return "DOWN_LEFT";
|
|
|
}
|
|
|
- }) {
|
|
|
- @Override
|
|
|
- public String getDebugOutput( Memory m ) {
|
|
|
- state = State.LAYOUT2;
|
|
|
- return super.getDebugOutput( m );
|
|
|
- }
|
|
|
- });
|
|
|
+ }));
|
|
|
mainFunction.add( new PseudoCodeNode( "call calcLayout( layout, graph )", vars, tree, new FunctionCall( calcLayout, new String[]{ "layout", "graph" } ) ) );
|
|
|
mainFunction.add( new PseudoCodeNode( "layout = 'UP_RIGHT'", vars, tree, new SetVariable<String>( "layout" ) {
|
|
|
@Override
|
|
|
protected String value(ReadOnlyMemory m) {
|
|
|
return "UP_RIGHT";
|
|
|
}
|
|
|
- }) {
|
|
|
- @Override
|
|
|
- public String getDebugOutput( Memory m ) {
|
|
|
- state = State.LAYOUT3;
|
|
|
- return super.getDebugOutput( m );
|
|
|
- }
|
|
|
- } );
|
|
|
+ }) );
|
|
|
mainFunction.add( new PseudoCodeNode( "call calcLayout( layout, graph )", vars, tree, new FunctionCall( calcLayout, new String[]{ "layout", "graph" } ) ) );
|
|
|
mainFunction.add( new PseudoCodeNode( "layout = 'UP_LEFT'", vars, tree, new SetVariable<String>( "layout" ) {
|
|
|
@Override
|
|
|
protected String value(ReadOnlyMemory m) {
|
|
|
return "UP_LEFT";
|
|
|
}
|
|
|
- }) {
|
|
|
- @Override
|
|
|
- public String getDebugOutput( Memory m ) {
|
|
|
- state = State.LAYOUT4;
|
|
|
- return super.getDebugOutput( m );
|
|
|
- }
|
|
|
- } );
|
|
|
+ }) );
|
|
|
mainFunction.add( new PseudoCodeNode( "call calcLayout( layout, graph )", vars, tree, new FunctionCall( calcLayout, new String[]{ "layout", "graph" } ) ) );
|
|
|
- mainFunction.add( new PseudoCodeNode( "call combine( graph )", vars, tree, new FunctionCall( combine, new String[]{ "graph" } ) ) {
|
|
|
- @Override
|
|
|
- public String getDebugOutput( Memory m ) {
|
|
|
- state = State.COMBINE;
|
|
|
- return super.getDebugOutput( m );
|
|
|
- }
|
|
|
- } );
|
|
|
+ mainFunction.add( new PseudoCodeNode( "call combine( graph )", vars, tree, new FunctionCall( combine, new String[]{ "graph" } ) ) );
|
|
|
PseudoCodeNode conflictsStage = new PseudoCodeNode( "-- mark type 1 conflicts --", vars, tree, new Comment() ) {
|
|
|
@Override
|
|
|
public String getDebugOutput( Memory m ) {
|
|
@@ -165,6 +135,23 @@ public class BKNodePlacement extends AnimatedAlgorithm {
|
|
|
info += "|------|-------|------|------|-------|-----|--------|\n";
|
|
|
LayeredGraphNode graph = m.read( "graph", MemoryType.COMPLETE_STACK );
|
|
|
LayoutType type = LayoutType.fromString( m.read( "layout", MemoryType.COMPLETE_STACK ) );
|
|
|
+ switch( type ) {
|
|
|
+ case TOP_BOTTOM_LEFT:
|
|
|
+ state = State.LAYOUT1;
|
|
|
+ break;
|
|
|
+ case TOP_BOTTOM_RIGHT:
|
|
|
+ state = State.LAYOUT2;
|
|
|
+ break;
|
|
|
+ case BOTTOM_TOP_LEFT:
|
|
|
+ state = State.LAYOUT3;
|
|
|
+ break;
|
|
|
+ case BOTTOM_TOP_RIGHT:
|
|
|
+ state = State.LAYOUT4;
|
|
|
+ break;
|
|
|
+ case COMBINED:
|
|
|
+ state = State.COMBINE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
for( LayeredGraphNode n : graph.getContainedNodes() )
|
|
|
{
|
|
|
info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) +
|