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

public class QAccessAccess extends QOptionalAccess
{
    protected void validateChild(Object child, QContext context)
	throws QPE
    {
	if (!(child instanceof QAccess))
	    context.throwPE("requires QAccess child, not"+
			    child.getClass());
    }

    protected Object get(Object parent, QContext context)
	throws QPE
    {
	validateParent(parent,context);
	QCMFactory cmf=(QCMFactory)parent;
	return cmf.access;
    }

    public void add(Object parent, 
		    QTargetFactory parentFactory,
		    Object child, 
		    QContext context)
	throws QPE
    {
	validateParent(parent,context);
	validateChild(child,context);
	QCMFactory cmf=(QCMFactory)parent;
	cmf.access=(QAccess)child;
    }
}
