gpt4 book ai didi

net.sf.saxon.expr.XPathContextMajor.setLocalVariable()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 19:11:40 25 4
gpt4 key购买 nike

本文整理了Java中net.sf.saxon.expr.XPathContextMajor.setLocalVariable()方法的一些代码示例,展示了XPathContextMajor.setLocalVariable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPathContextMajor.setLocalVariable()方法的具体详情如下:
包路径:net.sf.saxon.expr.XPathContextMajor
类名称:XPathContextMajor
方法名:setLocalVariable

XPathContextMajor.setLocalVariable介绍

暂无

代码示例

代码示例来源:origin: net.sf.saxon/Saxon-HE

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  XPathContext c = context;
  while (!(c instanceof XPathContextMajor)) {
    c = c.getCaller();
  }
  XPathContextMajor cm = (XPathContextMajor)c;
  if (actualParams.length == 1) {
    cm.setLocalVariable(actualParams[0].getSlotNumber(), actualParams[0].getSelectValue(context));
  } else {
    // we can't overwrite any of the parameters until we've evaluated all of them: test iterate012
    Sequence[] oldVars = cm.getAllVariableValues();
    Sequence[] newVars = Arrays.copyOf(oldVars, oldVars.length);
    for (WithParam wp : actualParams) {
      newVars[wp.getSlotNumber()] = wp.getSelectValue(context);
    }
    cm.resetAllVariableValues(newVars);
  }
  cm.requestTailCall(this, null);
  return null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  XPathContext c = context;
  while (!(c instanceof XPathContextMajor)) {
    c = c.getCaller();
  }
  XPathContextMajor cm = (XPathContextMajor)c;
  if (actualParams.length == 1) {
    cm.setLocalVariable(actualParams[0].getSlotNumber(), actualParams[0].getSelectValue(context));
  } else {
    // we can't overwrite any of the parameters until we've evaluated all of them: test iterate012
    Sequence[] oldVars = cm.getAllVariableValues();
    Sequence[] newVars = Arrays.copyOf(oldVars, oldVars.length);
    for (WithParam wp : actualParams) {
      newVars[wp.getSlotNumber()] = wp.getSelectValue(context);
    }
    cm.resetAllVariableValues(newVars);
  }
  cm.requestTailCall(this, null);
  return null;
}

代码示例来源:origin: net.sf.saxon/Saxon-B

/**
 * Call the function dynamically. For this to be possible, the static arguments of the function call
 * must have been set up as SuppliedParameterReference objects. The actual arguments are placed on the
 * callee's stack, and the type conversion takes place "in situ".
 * @param suppliedArguments the values to be used for the arguments of the function
 * @param context the dynamic evaluation context
 * @return the result of evaluating the function
 */
public ValueRepresentation dynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context) throws XPathException {
  ValueRepresentation[] convertedArgs = new ValueRepresentation[suppliedArguments.length];
  XPathContextMajor c2 = context.newCleanContext();
  c2.setOrigin(this);
  c2.setCaller(context);
  c2.openStackFrame(suppliedArguments.length);
  for (int i=0; i<suppliedArguments.length; i++) {
    c2.setLocalVariable(i, suppliedArguments[i]);
    convertedArgs[i] = ExpressionTool.lazyEvaluate(argument[i], c2, 10);
  }
  XPathContextMajor c3 = c2.newCleanContext();
  c3.setOrigin(this);
  return function.call(convertedArgs, c3);
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Call the function dynamically. For this to be possible, the static arguments of the function call
 * must have been set up as SuppliedParameterReference objects. The actual arguments are placed on the
 * callee's stack, and the type conversion takes place "in situ".
 * @param suppliedArguments the values to be used for the arguments of the function
 * @param context the dynamic evaluation context
 * @return the result of evaluating the function
 */
public ValueRepresentation dynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context) throws XPathException {
  ValueRepresentation[] convertedArgs = new ValueRepresentation[suppliedArguments.length];
  XPathContextMajor c2 = context.newCleanContext();
  c2.setOrigin(this);
  c2.setCaller(context);
  c2.openStackFrame(suppliedArguments.length);
  for (int i=0; i<suppliedArguments.length; i++) {
    c2.setLocalVariable(i, suppliedArguments[i]);
    convertedArgs[i] = ExpressionTool.lazyEvaluate(argument[i], c2, 10);
  }
  XPathContextMajor c3 = c2.newCleanContext();
  c3.setOrigin(this);
  return function.call(convertedArgs, c3);
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Call the function dynamically. For this to be possible, the static arguments of the function call
 * must have been set up as SuppliedParameterReference objects. The actual arguments are placed on the
 * callee's stack, and the type conversion takes place "in situ".
 * @param suppliedArguments the values to be used for the arguments of the function
 * @param context the dynamic evaluation context
 * @return the result of evaluating the function
 */
public ValueRepresentation dynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context) throws XPathException {
  ValueRepresentation[] convertedArgs = new ValueRepresentation[suppliedArguments.length];
  XPathContextMajor c2 = context.newCleanContext();
  c2.setOrigin(this);
  c2.setCaller(context);
  c2.openStackFrame(suppliedArguments.length);
  for (int i=0; i<suppliedArguments.length; i++) {
    c2.setLocalVariable(i, suppliedArguments[i]);
    convertedArgs[i] = ExpressionTool.lazyEvaluate(argument[i], c2, 10);
  }
  XPathContextMajor c3 = c2.newCleanContext();
  c3.setOrigin(this);
  return function.call(convertedArgs, c3);
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Apply an accumulator rule
 *
 * @param rule    the rule to apply
 * @param node    the node that was matched
 * @param isPostDescent false for the pre-descent visit to a node, true for the post-descent visit
 * @param value   the value of the accumulator before applying the rule
 * @param context the dynamic evaluation context
 * @return the value of the accumulator after applying the rule
 * @throws XPathException if a dynamic error occurs during the evaluation
 */
private Sequence<?> processRule(Rule rule, NodeInfo node, boolean isPostDescent, Sequence<?> value, XPathContext context) throws XPathException {
  AccumulatorRule target = (AccumulatorRule) rule.getAction();
  Expression delta = target.getNewValueExpression();
  XPathContextMajor c2 = context.newCleanContext();
  final Controller controller = c2.getController();
  assert controller != null;
  ManualIterator<NodeInfo> initialNode = new ManualIterator<>(node);
  c2.setCurrentIterator(initialNode);
  c2.openStackFrame(target.getStackFrameMap());
  c2.setLocalVariable(0, value);
  c2.setCurrentComponent(accumulator.getDeclaringComponent());
  c2.setTemporaryOutputState(StandardNames.XSL_ACCUMULATOR_RULE);
  value = Evaluator.EAGER_SEQUENCE.evaluate(delta, c2);
  //System.err.println("Node " + ((TinyNodeImpl) node).getNodeNumber() + " : " + value);
  values.add(new DataPoint(new Visit(node, isPostDescent), value));
  return value;
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

contextObject.setLocalVariable(variable.getLocalSlotNumber(), value);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Apply an accumulator rule
 *
 * @param rule    the rule to apply
 * @param node    the node that was matched
 * @param isPostDescent false for the pre-descent visit to a node, true for the post-descent visit
 * @param value   the value of the accumulator before applying the rule
 * @param context the dynamic evaluation context
 * @return the value of the accumulator after applying the rule
 * @throws XPathException if a dynamic error occurs during the evaluation
 */
private Sequence<?> processRule(Rule rule, NodeInfo node, boolean isPostDescent, Sequence<?> value, XPathContext context) throws XPathException {
  AccumulatorRule target = (AccumulatorRule) rule.getAction();
  Expression delta = target.getNewValueExpression();
  XPathContextMajor c2 = context.newCleanContext();
  final Controller controller = c2.getController();
  assert controller != null;
  ManualIterator<NodeInfo> initialNode = new ManualIterator<>(node);
  c2.setCurrentIterator(initialNode);
  c2.openStackFrame(target.getStackFrameMap());
  c2.setLocalVariable(0, value);
  c2.setCurrentComponent(accumulator.getDeclaringComponent());
  c2.setTemporaryOutputState(StandardNames.XSL_ACCUMULATOR_RULE);
  value = Evaluator.EAGER_SEQUENCE.evaluate(delta, c2);
  //System.err.println("Node " + ((TinyNodeImpl) node).getNodeNumber() + " : " + value);
  values.add(new DataPoint(new Visit(node, isPostDescent), value));
  return value;
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

"Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context");
contextObject.setLocalVariable(slot, value);

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
* Iterate over the results of the function
*/
public SequenceIterator iterate(XPathContext c) throws XPathException {
  PreparedExpression pexpr = prepareExpression(c);
  if (operation == EXPRESSION) {
    return SingletonIterator.makeIterator(new ObjectValue(pexpr));
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    return Value.getIterator(
        ExpressionTool.lazyEvaluate(pexpr.expression,  c2, 1));
  }
}

代码示例来源:origin: net.sf.saxon/Saxon-B

/**
* Iterate over the results of the function
*/
public SequenceIterator iterate(XPathContext c) throws XPathException {
  PreparedExpression pexpr = prepareExpression(c);
  if (operation == EXPRESSION) {
    return SingletonIterator.makeIterator(new ObjectValue(pexpr));
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    return Value.getIterator(
        ExpressionTool.lazyEvaluate(pexpr.expression,  c2, 1));
  }
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
* Iterate over the results of the function
*/
public SequenceIterator iterate(XPathContext c) throws XPathException {
  PreparedExpression pexpr = prepareExpression(c);
  if (operation == EXPRESSION) {
    return SingletonIterator.makeIterator(new ObjectValue(pexpr));
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    return Value.getIterator(
        ExpressionTool.lazyEvaluate(pexpr.expression,  c2, 1));
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

"Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context");
contextObject.setLocalVariable(slot, value);

代码示例来源:origin: net.sourceforge.saxon/saxon

"Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context"); 
contextObject.setLocalVariable(slot, value);

代码示例来源:origin: net.sf.saxon/Saxon-B

/**
* Evaluate in a general context
*/
public Item evaluateItem(XPathContext c) throws XPathException {
  if (operation == EXPRESSION) {
    PreparedExpression pexpr = prepareExpression(c);
    return new ObjectValue(pexpr);
  } else if (operation == EVALUATE_NODE) {
    XPathContextMajor c2 = c.newCleanContext();
    PreparedExpression pexpr = prepareExpression(c2);
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    return pexpr.expression.evaluateItem(c2);
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    PreparedExpression pexpr = prepareExpression(c2);
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    return pexpr.expression.evaluateItem(c2);
  }
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
* Evaluate in a general context
*/
public Item evaluateItem(XPathContext c) throws XPathException {
  if (operation == EXPRESSION) {
    PreparedExpression pexpr = prepareExpression(c);
    return new ObjectValue(pexpr);
  } else if (operation == EVALUATE_NODE) {
    XPathContextMajor c2 = c.newCleanContext();
    PreparedExpression pexpr = prepareExpression(c2);
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    return pexpr.expression.evaluateItem(c2);
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    PreparedExpression pexpr = prepareExpression(c2);
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    return pexpr.expression.evaluateItem(c2);
  }
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
* Evaluate in a general context
*/
public Item evaluateItem(XPathContext c) throws XPathException {
  if (operation == EXPRESSION) {
    PreparedExpression pexpr = prepareExpression(c);
    return new ObjectValue(pexpr);
  } else if (operation == EVALUATE_NODE) {
    XPathContextMajor c2 = c.newCleanContext();
    PreparedExpression pexpr = prepareExpression(c2);
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    return pexpr.expression.evaluateItem(c2);
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    PreparedExpression pexpr = prepareExpression(c2);
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    return pexpr.expression.evaluateItem(c2);
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com