// Path: src/net/sourceforge/arbaro/tree/Tree.java
// public interface Tree {
// 
// 	/**
// 	 * used with the TreeTraversal interface
// 	 *
// 	 * @param traversal
// 	 * @return when false stop travers the tree
// 	 */
// 	abstract boolean traverseTree(TreeTraversal traversal);
// 
// 	/**
// 	 *
// 	 * @return the number of all stems of all levels of the tree
// 	 */
// 	public abstract long getStemCount();
// 
// 	/**
// 	 *
// 	 * @return the number of leaves of the tree
// 	 */
// 	public abstract long getLeafCount();
// 
// 	/**
// 	 *
// 	 * @return a vector with the highest coordinates of the tree.
// 	 * (Considering all stems of all levels)
// 	 */
// 	public abstract Vector getMaxPoint();
// 
// 	/**
// 	 *
// 	 * @return a vector with the lowest coordinates of the tree.
// 	 * (Considering all stems of all levels)
// 	 */
// 	public abstract Vector getMinPoint();
// 
// 	/**
// 	 *
// 	 * @return the seed of the tree. It is used for randomnization.
// 	 */
// 	public int getSeed();
// 
// 	/**
// 	 *
// 	 * @return the height of the tree (highest z-coordinate)
// 	 */
// 	public double getHeight();
// 
// 	/**
// 	 *
// 	 * @return the widht of the tree (highest value of sqrt(x*x+y*y))
// 	 */
// 	public double getWidth();
// 
// 	/**
// 	 * Writes the trees parameters to a stream
// 	 * @param w
// 	 */
// 	public void paramsToXML(PrintWriter w);
// 
// 	/**
// 	 *
// 	 * @return the tree species name
// 	 */
// 	public String getSpecies();
// 
// 	/**
// 	 *
// 	 * @return the tree scale
// 	 */
// 	public double getScale();
// 
// 	/**
// 	 *
// 	 * @return the tree stem levels
// 	 */
// 	public int getLevels();
// 
// 	/**
// 	 *
// 	 * @return the leaf shape name
// 	 */
// 	public String getLeafShape();
// 
// 	/**
// 	 *
// 	 * @return the leaf width
// 	 */
// 	public double getLeafWidth();
// 
// 	/**
// 	 *
// 	 * @return the leaf length
// 	 */
// 	public double getLeafLength();
// 
// 	/**
// 	 *
// 	 * @return the virtual leaf stem length, i.e. the distance of
// 	 * the leaf from the stem center line
// 	 */
// 	public double getLeafStemLength();
// 
// 	/**
// 	 * Use this for verbose output when generating a mesh or
// 	 * exporting a tree
// 	 *
// 	 * @param level
// 	 * @return an information string with the number of section
// 	 * points for this stem level and if smoothing should be used
// 	 */
// 	public String getVertexInfo(int level);
// 
// }
// 
// Path: src/net/sourceforge/arbaro/tree/TreeGeneratorFactory.java
// public class TreeGeneratorFactory {
// 	static public TreeGenerator createTreeGenerator() {
// 		return new TreeGeneratorImpl();
// 	}
// 
// 	static public TreeGenerator createTreeGenerator(Params params) {
// 		return new TreeGeneratorImpl(params);
// 	}
// 
// 	static public TreeGenerator createShieldedTreeGenerator() {
// 		return new ShieldedTreeGenerator(new TreeGeneratorImpl());
// 	}
// 
// 	static public TreeGenerator createShieldedTreeGenerator(Params params) {
// 		return new ShieldedTreeGenerator(new TreeGeneratorImpl(params));
// 	}
// 
// 
// }	


import junit.framework.TestCase;
import net.sourceforge.arbaro.tree.Tree;
import net.sourceforge.arbaro.tree.TreeGenerator;
import net.sourceforge.arbaro.tree.TreeGeneratorFactory;
import net.sourceforge.arbaro.params.*;
import net.sourceforge.arbaro.feedback.Progress;
import java.util.*;
import java.io.*;

	public void testTreeGenerator () {
		ParamManager params = new ParamManager();
		// get params from String SassafrasCfg
		InputStream is = new ByteArrayInputStream(sassafrasCfg.getBytes());
		params.getParamReader().readFromCfg(is);

		TreeGenerator generator = TreeGeneratorFactory.createTreeGenerator(params);
		
		checkParams(generator.getParamManager().getTreeParams());
		
		// write Params as XML to a StringBuffer
		StringWriter xsw = new StringWriter();
		PrintWriter pw = new PrintWriter(xsw);
		params.getParamWriter().toXML(pw);
		
		// clear params
		params = new ParamManager();
//		generator.clearParams();
		
		assertEquals(params.getParamEditing().getSpecies(),"default");
		
		// read params again from there
		InputStream xis = new ByteArrayInputStream(xsw.toString().getBytes());
		params.getParamReader().readFromXML(xis);

		generator = TreeGeneratorFactory.createTreeGenerator(params);
		checkParams(generator.getParamManager().getTreeParams());

		// make Tree with this params
// Path: src/net/sourceforge/arbaro/tree/Tree.java
// public interface Tree {
// 
// 	/**
// 	 * used with the TreeTraversal interface
// 	 *
// 	 * @param traversal
// 	 * @return when false stop travers the tree
// 	 */
// 	abstract boolean traverseTree(TreeTraversal traversal);
// 
// 	/**
// 	 *
// 	 * @return the number of all stems of all levels of the tree
// 	 */
// 	public abstract long getStemCount();
// 
// 	/**
// 	 *
// 	 * @return the number of leaves of the tree
// 	 */
// 	public abstract long getLeafCount();
// 
// 	/**
// 	 *
// 	 * @return a vector with the highest coordinates of the tree.
// 	 * (Considering all stems of all levels)
// 	 */
// 	public abstract Vector getMaxPoint();
// 
// 	/**
// 	 *
// 	 * @return a vector with the lowest coordinates of the tree.
// 	 * (Considering all stems of all levels)
// 	 */
// 	public abstract Vector getMinPoint();
// 
// 	/**
// 	 *
// 	 * @return the seed of the tree. It is used for randomnization.
// 	 */
// 	public int getSeed();
// 
// 	/**
// 	 *
// 	 * @return the height of the tree (highest z-coordinate)
// 	 */
// 	public double getHeight();
// 
// 	/**
// 	 *
// 	 * @return the widht of the tree (highest value of sqrt(x*x+y*y))
// 	 */
// 	public double getWidth();
// 
// 	/**
// 	 * Writes the trees parameters to a stream
// 	 * @param w
// 	 */
// 	public void paramsToXML(PrintWriter w);
// 
// 	/**
// 	 *
// 	 * @return the tree species name
// 	 */
// 	public String getSpecies();
// 
// 	/**
// 	 *
// 	 * @return the tree scale
// 	 */
// 	public double getScale();
// 
// 	/**
// 	 *
// 	 * @return the tree stem levels
// 	 */
// 	public int getLevels();
// 
// 	/**
// 	 *
// 	 * @return the leaf shape name
// 	 */
// 	public String getLeafShape();
// 
// 	/**
// 	 *
// 	 * @return the leaf width
// 	 */
// 	public double getLeafWidth();
// 
// 	/**
// 	 *
// 	 * @return the leaf length
// 	 */
// 	public double getLeafLength();
// 
// 	/**
// 	 *
// 	 * @return the virtual leaf stem length, i.e. the distance of
// 	 * the leaf from the stem center line
// 	 */
// 	public double getLeafStemLength();
// 
// 	/**
// 	 * Use this for verbose output when generating a mesh or
// 	 * exporting a tree
// 	 *
// 	 * @param level
// 	 * @return an information string with the number of section
// 	 * points for this stem level and if smoothing should be used
// 	 */
// 	public String getVertexInfo(int level);
// 
// }
// 
// Path: src/net/sourceforge/arbaro/tree/TreeGeneratorFactory.java
// public class TreeGeneratorFactory {
// 	static public TreeGenerator createTreeGenerator() {
// 		return new TreeGeneratorImpl();
// 	}
// 
// 	static public TreeGenerator createTreeGenerator(Params params) {
// 		return new TreeGeneratorImpl(params);
// 	}
// 
// 	static public TreeGenerator createShieldedTreeGenerator() {
// 		return new ShieldedTreeGenerator(new TreeGeneratorImpl());
// 	}
// 
// 	static public TreeGenerator createShieldedTreeGenerator(Params params) {
// 		return new ShieldedTreeGenerator(new TreeGeneratorImpl(params));
// 	}
// 
// 
// }	


// Path: test/net/sourceforge/arbaro/tree/impl/treeTest.java
import junit.framework.TestCase;
import net.sourceforge.arbaro.tree.Tree;
import net.sourceforge.arbaro.tree.TreeGenerator;
import net.sourceforge.arbaro.tree.TreeGeneratorFactory;
import net.sourceforge.arbaro.params.*;
import net.sourceforge.arbaro.feedback.Progress;
import java.util.*;
import java.io.*;


	public void testTreeGenerator () {
		ParamManager params = new ParamManager();
		// get params from String SassafrasCfg
		InputStream is = new ByteArrayInputStream(sassafrasCfg.getBytes());
		params.getParamReader().readFromCfg(is);

		TreeGenerator generator = TreeGeneratorFactory.createTreeGenerator(params);
		
		checkParams(generator.getParamManager().getTreeParams());
		
		// write Params as XML to a StringBuffer
		StringWriter xsw = new StringWriter();
		PrintWriter pw = new PrintWriter(xsw);
		params.getParamWriter().toXML(pw);
		
		// clear params
		params = new ParamManager();
//		generator.clearParams();
		
		assertEquals(params.getParamEditing().getSpecies(),"default");
		
		// read params again from there
		InputStream xis = new ByteArrayInputStream(xsw.toString().getBytes());
		params.getParamReader().readFromXML(xis);

		generator = TreeGeneratorFactory.createTreeGenerator(params);
		checkParams(generator.getParamManager().getTreeParams());

		// make Tree with this params
		Tree tree = generator.makeTree(new Progress());