package com.jxml.quick.util.qiml2java;
import com.jxml.quick.model.qiml.*;
import com.jxml.quick.ocm.*;
import com.jxml.quick.*;
import org.xml.sax.*;
import java.io.*;
import java.util.*;

public class QCElementDefinition extends OCMtemplate
{
	String newVar;
	String var=null;
	String contentName;
	String subEName;
	String tag;
	public void cvt(Object param)
		throws SAXException, IOException
	{
		QIML2JAVA.SubQIML2JAVA qiml=(QIML2JAVA.SubQIML2JAVA)context;
		ElementDefinition dm=(ElementDefinition)dataModel;
		if (var!=null)
		{
			newVar=(String)param;
			expand("beenHere");
			return;
		}
		var=(String)param;
		expand("template");
		tag=dm.getTagName_4();
		if (!"".equals(tag))
		{
			expand("tag");
		}
		boolean isIdRef=dm.getIsIdRef_8();
		if (isIdRef)
		{
			expand("isIdRef");
		}
		boolean wild=dm.getWild_5();
		if (wild)
		{
			expand("wild");
		}
		boolean conditional=dm.getConditional_9();
		if (conditional)
		{
			expand("conditional");
		}
		boolean isBimodal=dm.getBimodal_6();
		if (isBimodal)
		{
			expand("isBimodal");
		}
		boolean isCData=dm.getCdata_10();
		if (isCData)
		{
			expand("isCData");
		}
		int i,s;
		Target target=dm.getTarget_12();
		doCvt(target,var);
		ArrayList subElements=dm.getDerivedCoins_13();
		s=subElements.size();
		for (i=0;i<s;++i)
		{
			subEName=qiml.makeName();
			Object subE=subElements.get(i);
			doCvt(subE,subEName);
			expand("subElement");
		}
		ArrayList contents=dm.getContentModel_14();
		s=contents.size();
		for (i=0;i<s;++i)
		{
			contentName=qiml.makeName();
			Object content=contents.get(i);
			doCvt(content,contentName);
			expand("content");
		}
	}
	public String process(String templateName, String arg)
		throws SAXException, IOException
	{
		if("tag".equals(arg))
			return tag;
		if("newVar".equals(arg))
			return newVar;
		if("var".equals(arg))
			return var;
		if("subEName".equals(arg))
			return subEName;
		if("id".equals(arg))
		{
			QIML2JAVA.SubQIML2JAVA qiml=(QIML2JAVA.SubQIML2JAVA)context;
			ElementDefinition dm=(ElementDefinition)dataModel;
			return Quick.getId(qiml.inputDoc,dm);
		}
		if("contentName".equals(arg))
			return contentName;
		return "";
	}
}
