package com.jxml.quick.access;
import com.jxml.quick.*;
import com.jxml.quick.tf.*;

public abstract class QSimpleAccess extends QAccess
{
    public boolean readable(QTargetFactory parentFactory, QContext context)
	throws QPE
    {
	return true;
    }

    public QIterator createIterator()
    {
	return new QSimpleIterator();
    }

    protected abstract Object get(Object parent, QContext context)
	throws QPE;

    public void setIteratorParent(QIterator it, 
				  Object parent, 
				  QTargetFactory parentFactory,
				  QContext context)
	throws QPE
    {
	((QSimpleIterator)it).setCurrent(get(parent,context));
    }

    public boolean writeable(QTargetFactory parentFactory, QContext context)
	throws QPE
    {
	return true;
    }

    public abstract void add(Object parent, 
			     QTargetFactory parentFactory,
			     Object child, 
			     QContext context)
	throws QPE;
}
