void Step::evaluate(EvaluationContext& evaluationContext, Node* context, NodeSet& nodes) const { evaluationContext.position = 0; nodesInAxis(evaluationContext, context, nodes); // Check predicates that couldn't be merged into node test. for (unsigned i = 0; i < m_predicates.size(); i++) { Predicate* predicate = m_predicates[i].get(); OwnPtrWillBeRawPtr<NodeSet> newNodes(NodeSet::create()); if (!nodes.isSorted()) newNodes->markSorted(false); for (unsigned j = 0; j < nodes.size(); j++) { Node* node = nodes[j]; evaluationContext.node = node; evaluationContext.size = nodes.size(); evaluationContext.position = j + 1; if (predicate->evaluate(evaluationContext)) newNodes->append(node); } nodes.swap(*newNodes); } }
void Step::evaluate(Node* context, NodeSet& nodes) const { EvaluationContext& evaluationContext = Expression::evaluationContext(); evaluationContext.position = 0; nodesInAxis(context, nodes); // Check predicates that couldn't be merged into node test. for (unsigned i = 0; i < m_predicates.size(); i++) { Predicate* predicate = m_predicates[i].get(); NodeSet newNodes; if (!nodes.isSorted()) newNodes.markSorted(false); for (unsigned j = 0; j < nodes.size(); j++) { Node* node = nodes[j]; evaluationContext.node = node; evaluationContext.size = nodes.size(); evaluationContext.position = j + 1; if (predicate->evaluate()) newNodes.append(node); } nodes.swap(newNodes); } }
void Step::evaluate(Node* context, NodeSet& nodes) const { nodesInAxis(context, nodes); EvaluationContext& evaluationContext = Expression::evaluationContext(); for (unsigned i = 0; i < m_predicates.size(); i++) { Predicate* predicate = m_predicates[i]; NodeSet newNodes; if (!nodes.isSorted()) newNodes.markSorted(false); evaluationContext.size = nodes.size(); evaluationContext.position = 1; for (unsigned j = 0; j < nodes.size(); j++) { Node* node = nodes[j]; Expression::evaluationContext().node = node; EvaluationContext backupCtx = evaluationContext; if (predicate->evaluate()) newNodes.append(node); evaluationContext = backupCtx; ++evaluationContext.position; } nodes.swap(newNodes); } }