/*
 * Copyright (C) 2004-2005  exedio GmbH (www.exedio.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.exedio.cope;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

public final class StatementInfo
{
	private final ArrayList childs = new ArrayList();
	final String text;
	
	StatementInfo(final String text)
	{
		this.text = text;
	}
	
	public String getText()
	{
		return text;
	}
	
	public Collection getChilds()
	{
		return Collections.unmodifiableList(childs);
	}
	
	void addChild(final StatementInfo newChild)
	{
		childs.add(newChild);
	}
	
	public void print(final PrintStream o)
	{
		printInternal(o, 0);
	}

	private void printInternal(final PrintStream o, int level)
	{
		for(int i=0; i<level; i++)
			o.print("  ");
		o.println(text);
		level++;
		for(Iterator i = childs.iterator(); i.hasNext(); )
			((StatementInfo)i.next()).printInternal(o, level);
	}

}

@@ -1393,32 +1393,24 @@
 )%0A%09%7B%0A%09%09print
-Internal
 (o, 0);%0A%09%7D%0A%0A
@@ -1428,24 +1428,16 @@
 id print
-Internal
 (final P
@@ -1632,16 +1632,8 @@
 rint
-Internal
 (o, 

rename printInternal to print