/** * Get the operand roles * @return the roles of the operands as an array, one per operand */ public OperandRole[] getRoles() { OperandRole[] or = new OperandRole[operandArray.length]; for (int i = 0; i < or.length; i++) { or[i] = operandArray[i].getOperandRole(); } return or; }
/** * Get the operand roles * @return the roles of the operands as an array, one per operand */ public OperandRole[] getRoles() { OperandRole[] or = new OperandRole[operandArray.length]; for (int i = 0; i < or.length; i++) { or[i] = operandArray[i].getOperandRole(); } return or; }
private Expression getContainingConditional(Expression exp) { Expression parent = exp.getParentExpression(); while (parent != null) { if (parent instanceof ConditionalInstruction) { Operand o = ExpressionTool.findOperand(parent, exp); if (o == null) { throw new AssertionError(); } if (o.getOperandRole().isInChoiceGroup()) { return parent; } } exp = parent; parent = parent.getParentExpression(); } return null; }
private Expression getContainingConditional(Expression exp) { Expression parent = exp.getParentExpression(); while (parent != null) { if (parent instanceof ConditionalInstruction) { Operand o = ExpressionTool.findOperand(parent, exp); if (o == null) { throw new AssertionError(); } if (o.getOperandRole().isInChoiceGroup()) { return parent; } } exp = parent; parent = parent.getParentExpression(); } return null; }
/** * Gather a list of all the variable bindings on which a given expression depends. * In the light of spec bug 29590, this only considers variable references that * are unconditionally evaluated: that is, it ignores variable references appearing * in the then/else branches of a conditional or equivalent. Cycles involving * conditional evaluation are detected dynamically. * * @param e the expression being tested * @param list a list to which the bindings are to be added. The items in this list must * implement {@link Binding} */ public static void gatherReferencedVariables(Expression e, List<Binding> list) { if (e instanceof VariableReference) { Binding binding = ((VariableReference) e).getBinding(); if (!list.contains(binding)) { list.add(binding); } } else { for (Operand o : e.operands()) { if (!o.getOperandRole().isInChoiceGroup()) { gatherReferencedVariables(o.getChildExpression(), list); } } } }
/** * Gather a list of all the variable bindings on which a given expression depends. * In the light of spec bug 29590, this only considers variable references that * are unconditionally evaluated: that is, it ignores variable references appearing * in the then/else branches of a conditional or equivalent. Cycles involving * conditional evaluation are detected dynamically. * * @param e the expression being tested * @param list a list to which the bindings are to be added. The items in this list must * implement {@link Binding} */ public static void gatherReferencedVariables(Expression e, List<Binding> list) { if (e instanceof VariableReference) { Binding binding = ((VariableReference) e).getBinding(); if (!list.contains(binding)) { list.add(binding); } } else { for (Operand o : e.operands()) { if (!o.getOperandRole().isInChoiceGroup()) { gatherReferencedVariables(o.getChildExpression(), list); } } } }
Operand o = ExpressionTool.findOperand(parent, child); assert o != null; if (exp.isLiftable(streaming) && !(child instanceof PseudoExpression) && !o.getOperandRole().isConstrainedClass()) { Expression lifted = lift(exp, child); o.setChildExpression(lifted); if (!o.getOperandRole().isConstrainedClass()) { loopLift(o.getChildExpression());
Operand o = ExpressionTool.findOperand(parent, child); assert o != null; if (exp.isLiftable(streaming) && !(child instanceof PseudoExpression) && !o.getOperandRole().isConstrainedClass()) { Expression lifted = lift(exp, child); o.setChildExpression(lifted); if (!o.getOperandRole().isConstrainedClass()) { loopLift(o.getChildExpression());
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { selectOp.typeCheck(visitor, contextInfo); ItemType selectType = getSelect().getItemType(); if (selectType == ErrorType.getInstance()) { return Literal.makeEmptySequence(); } ContextItemStaticInfo cit = visitor.getConfiguration().makeContextItemStaticInfo(getSelect().getItemType(), false); cit.setContextSettingExpression(getSelect()); actionOp.typeCheck(visitor, cit); if (!Cardinality.allowsMany(getSelect().getCardinality())) { actionOp.setOperandRole(actionOp.getOperandRole().modifyProperty(OperandRole.SINGLETON, true)); } return this; }
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { selectOp.typeCheck(visitor, contextInfo); ItemType selectType = getSelect().getItemType(); if (selectType == ErrorType.getInstance()) { return Literal.makeEmptySequence(); } ContextItemStaticInfo cit = visitor.getConfiguration().makeContextItemStaticInfo(getSelect().getItemType(), false); cit.setContextSettingExpression(getSelect()); actionOp.typeCheck(visitor, cit); if (!Cardinality.allowsMany(getSelect().getCardinality())) { actionOp.setOperandRole(actionOp.getOperandRole().modifyProperty(OperandRole.SINGLETON, true)); } return this; }