/** * Return the value of the variable * * @param c the XPath dynamic context * @return the value of the variable * @throws XPathException if any dynamic error occurs while evaluating the variable */ /*@NotNull*/ public Sequence<?> evaluateVariable(XPathContext c) throws XPathException { try { return c.getStackFrame().slots[slotNumber]; } catch (ArrayIndexOutOfBoundsException err) { if (slotNumber == -999) { if (binding != null) { try { slotNumber = getBinding().getLocalSlotNumber(); return c.getStackFrame().slots[slotNumber]; } catch (ArrayIndexOutOfBoundsException err2) { // fall through } } throw new ArrayIndexOutOfBoundsException("Local variable $" + getDisplayName() + " has not been allocated a stack frame slot"); } else { int actual = c.getStackFrame().slots.length; throw new ArrayIndexOutOfBoundsException("Local variable $" + getDisplayName() + " uses slot " + slotNumber + " but " + (actual == 0 ? "no" : "only " + c.getStackFrame().slots.length) + " slots" + " are allocated on the stack frame"); } } }
/** * Return the value of the variable * * @param c the XPath dynamic context * @return the value of the variable * @throws XPathException if any dynamic error occurs while evaluating the variable */ /*@NotNull*/ public Sequence<?> evaluateVariable(XPathContext c) throws XPathException { try { return c.getStackFrame().slots[slotNumber]; } catch (ArrayIndexOutOfBoundsException err) { if (slotNumber == -999) { if (binding != null) { try { slotNumber = getBinding().getLocalSlotNumber(); return c.getStackFrame().slots[slotNumber]; } catch (ArrayIndexOutOfBoundsException err2) { // fall through } } throw new ArrayIndexOutOfBoundsException("Local variable $" + getDisplayName() + " has not been allocated a stack frame slot"); } else { int actual = c.getStackFrame().slots.length; throw new ArrayIndexOutOfBoundsException("Local variable $" + getDisplayName() + " uses slot " + slotNumber + " but " + (actual == 0 ? "no" : "only " + c.getStackFrame().slots.length) + " slots" + " are allocated on the stack frame"); } } }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. * * @param out the expression presenter used to display the structure */ @Override public void explain(ExpressionPresenter out) { out.startElement("group-by"); for (Operand o : getRetainedTupleExpression().operands()) { LocalVariableReference ref = (LocalVariableReference)o.getChildExpression(); out.startSubsidiaryElement("by"); out.emitAttribute("var", ref.getDisplayName()); out.emitAttribute("slot", ref.getBinding().getLocalSlotNumber() + ""); out.endSubsidiaryElement(); } out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. * * @param out the expression presenter used to display the structure */ @Override public void explain(ExpressionPresenter out) { out.startElement("group-by"); for (Operand o : getRetainedTupleExpression().operands()) { LocalVariableReference ref = (LocalVariableReference)o.getChildExpression(); out.startSubsidiaryElement("by"); out.emitAttribute("var", ref.getDisplayName()); out.emitAttribute("slot", ref.getBinding().getLocalSlotNumber() + ""); out.endSubsidiaryElement(); } out.endElement(); }