package com.jxml.quick.util.qdml2qjml;
import com.jxml.quick.model.qjml.*;
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import com.jxml.quick.ocm.*;
import java.io.*;
import com.jxml.quick.recycle.*;
import com.jxml.quick.engine.*;

public class QCSelection extends OCMpeerSupportLite
{
	public void cvt(Object param)
		throws SAXException, IOException
	{
		QMSelection dm=(QMSelection)dataModel;
		QDML2QJML.SubQdml2Qjml c=(QDML2QJML.SubQdml2Qjml)context;
		QMProperty p=new QMProperty();
		String s=c.labelToProperty(c.currentCoinLabel);
		p.name=s;
		p.coin=s;
		if(isAList())
			p.kind="list";
		dm.access=p;
		QMAbstract a=new QMAbstract();
		a.generate=false;
		a.label=s;
		QMTargetClass tc=new QMTargetClass();
		tc.text="java.lang.Object";
		a.targetClass=tc;
		c.coins.add(c.pos+1,a);
	}

	public boolean isAList()
		throws SAXException, IOException
	{
		QMSelection dm=(QMSelection)dataModel;
		if(dm.repeating)
			return true;
		int s;
		int i;

		s=dm.contentList.size();
		for(i=0;i<s;++i)
		{
			QMContentModel o=(QMContentModel)dm.contentList.get(i);
			if(o.repeating)
				return true;
			if(o instanceof QMSequence)
				return true;
			if(o instanceof QMSelection)
			{
				QCSelection ps=(QCSelection)peer(o);
				if(ps.isAList())
					return true;
			}
		}
		return false;
	}
}
