// copyright => http://www.jxml.com/mdsax/License.txt

package com.jxml.quick;
import java.util.*;

public class QListFactory extends QFilterFactory
{
    public ArrayList factories=new ArrayList();

    protected QFilter newFilter()
	throws QE
    {
	return new QList();
    }

    public void addFactory(QFilterFactory factory)
	throws QE
    {
	factories.add(factory);
    }

    public void importFactories(QListFactory listFactory)
	throws QE
    {
	ArrayList ffs=listFactory.factories;
	int s=ffs.size();
	int i;
	for (i=0;i<s;++i)
	    {
		QFilterFactory f=(QFilterFactory)ffs.get(i);
		f.addToFactory(this);
	    }
    }

    public class QList extends QFilter
    {
	public ArrayList filters=null;
	
	public QList()
	    throws QE
	{
	}

	public void init()
	    throws QE
	{
	    if (filters!=null)
		return;
	    int s=factories.size();
	    filters=new ArrayList(s);
	    int i;
	    for (i=0;i<s;++i)
		{
		    QFilterFactory ff=(QFilterFactory)factories.get(i);
		    QFilter f=ff.createFilter(newContext);
		    filters.add(f);
		}
	}
    }
}
