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 where the for extremal layouts are computed.
 * @author kolja
 *
 */
public class ExtremalLayoutCalc implements AlgorithmStage {
	
	/**
     * There are four types of layouts, based on iteration order and median alignment.
     * Additionally there is one layout for the combined coordinates.
     * @author kolja
     *
     */
    public enum LayoutType{
        TOP_BOTTOM_LEFT,
        TOP_BOTTOM_RIGHT,
        BOTTOM_TOP_LEFT,
        BOTTOM_TOP_RIGHT,
        COMBINED
    }
	
    private LayeredGraphNode graph;
    private AnimatedAlgorithm alg;

    public ExtremalLayoutCalc( LayeredGraphNode graph, AnimatedAlgorithm alg )
    {
        this.graph = graph;
        this.alg = alg;
    }

    @Override
    public PseudoCodeNode createPseudocodeTree( JTree tree ) {
    	PseudoCodeNode root = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "function calcLaout( layout, graph )", new String[0] ), tree, new CodeLine() {

			@Override
			public ControlFlow runForward(Memory m) {
				// TODO Auto-generated method stub
				return null;
			}
    		
    	}, alg );
        return root;
    }

    @Override
    public String getDebugString()
    {
        String info = "| Node | Shift | Sink | Root | Align |  x  |  xDef  |\n";
        info +=       "|------|-------|------|------|-------|-----|--------|\n";
        return info;
    }
}
