package tree;

import java.util.LinkedList;

public class TreeWithContours extends TreeNode{
    LinkedList<Double> leftcontour;
    LinkedList<Double> rightcontour;

    TreeWithContours(String label, ForestWithContours children){
	super(label, children);
	if (!children.isEmpty()){
	    double offset=children.firstlast/2;
	    children.getFirst().setX(-offset);
	    leftcontour=children.leftcontour;
	    leftcontour.addFirst(-offset);
	    rightcontour=children.rightcontour;
	    rightcontour.addFirst(offset);
	}
	else {
	    leftcontour=new LinkedList<Double>();
	    rightcontour=new LinkedList<Double>();
	}
    }

    public TreeWithContours(DrawableTreeNode tree){
	this(tree.getLabel(),new ForestWithContours(tree.getChildren()));
    }

}

