Team:Freiburg software/Code/RecChildBlipListBuilder.java

From 2009.igem.org


RecChildBlipListBuilder

/*
*    Copyright: synbiowave
*     
*    License: GPL
*     
*    Authors: Paul Staab
*     
*    Version: 0.1 
*    
*    DESCRIPTION:
*    	Small class to create a list of all the blips of a wave. 
*/

package org.synbiowave;

import java.util.ArrayList;

public class RecChildBlipListBuilder {
	private ArrayList<Blip> recChildList = new ArrayList<Blip>();
	
	RecChildBlipListBuilder(Blip blip)
	{
		this.recBuilder(blip);
	}
	
	private void recBuilder(Blip blip)
	{
		try {
		this.recChildList.add(blip);
		//blip.getDocument().append("Children: " + blip.getChildren().size() + "\n");
		for (Blip blip2 : blip.getChildren())
		{
			this.recBuilder(blip2);
		}
		}
		catch (Exception error)
		{
			blip.createChild().getDocument().append("ERROR:" + error.toString());
		}
	}
	
	public ArrayList<Blip> getRecChildList()
	{
		return this.recChildList;
	}	
}