if (test.isWildcardTest()) { return contextSet.getParents(contextId);
if (test.isWildcardTest() || (!(contextSet instanceof VirtualNodeSet) && contextSet.getLength() < 3)) { NodeSet temp = contextSet.getParents(contextId); NodeSet result = new ExtArrayNodeSet(); NodeProxy p; for (Iterator i = temp.iterator(); i.hasNext(); ) { p = (NodeProxy) i.next(); if (test.matches(p)) result.add(p); } return result;
    protected NodeSet getParents(XQueryContext context, NodeSet contextSet) {        if (test.isWildcardTest()) {            return contextSet.getParents(contextId);        } else {            DocumentSet docs = getDocumentSet(contextSet);            NodeSelector selector = new ParentSelector(contextSet, contextId);            ElementIndex index = context.getBroker().getElementIndex();            if (context.getProfiler().isEnabled())                context.getProfiler().message(this, Profiler.OPTIMIZATIONS,                        "OPTIMIZATION",                        "using index '" + index.toString() + "'");            return index.findElementsByTagName(ElementValue.ELEMENT, docs, test                    .getName(), selector);        }    }