// Mike Maxim
// IRTree for statement

package edu.cmu.cs.l3.tree;

import java.util.TreeSet;
import java.util.Iterator;
import edu.cmu.cs.l3.general.*;

abstract public class IRStatement extends Visitable {
    

    public void visit(Visitor v) {
	v.visitResponse(m_classname, this);
    }

    public String getClassName() {
	return m_classname;
    }

    public String toString() {
	//String loopstr = "";
	//for(Iterator it = loops.iterator(); it.hasNext(); ) {
	//    loopstr += it.next().toString();
	//    loopstr += " ";
	//}
	return m_classname /*+ " loops(" + loopstr + ")"*/;
    }

    /*public void setLoop(IRLabel loopID) {
	loops.add(loopID.toString());
	//System.out.println("set loop " + loopID + " to statement " + this);
    }

    public void addLoops(TreeSet newLoops) {
	loops.addAll(newLoops);
	//System.out.println("added " + newLoops.size() + " loops to statement " + this);
    }

    public TreeSet getLoops() {
	return loops;
    }
    
    public void removeLoop(String loopID) {
	loops.remove(loopID);
    }

    public boolean loopMember(String loopID) {
	return loops.contains(loopID);
    }*/

    abstract public IRExpressionList getComponents();
    abstract public IRStatement build(IRExpressionList comps);

    protected String m_classname;

    //empty by default
    protected TreeSet loops = new TreeSet();
}


