Search in sources :

Example 1 with AxisStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep in project webtools.sourceediting by eclipse.

the class Normalizer method make_descendant_or_self.

private XPathExpr make_descendant_or_self() {
    Step desc_self_node = new ForwardStep(ForwardStep.DESCENDANT_OR_SELF, new AnyKindTest());
    StepExpr se = new AxisStep(desc_self_node, new ArrayList());
    return new XPathExpr(0, se);
}
Also used : ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) StepExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr) ArrayList(java.util.ArrayList) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) ReverseStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep) Step(org.eclipse.wst.xml.xpath2.processor.internal.ast.Step) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) AnyKindTest(org.eclipse.wst.xml.xpath2.processor.internal.ast.AnyKindTest) XPathExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)

Example 2 with AxisStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep in project webtools.sourceediting by eclipse.

the class Normalizer method make_root_self_node.

private XPathExpr make_root_self_node() {
    // self::node()
    Step self_node = new ForwardStep(ForwardStep.SELF, new AnyKindTest());
    StepExpr self_node_expr = new AxisStep(self_node, new ArrayList());
    XPathExpr self_node_xpath = new XPathExpr(0, self_node_expr);
    // fn:root(self::node())
    Collection args = new ArrayList();
    args.add(self_node_xpath);
    XPathExpr xpe = make_function(new QName("fn", "root", FnFunctionLibrary.XPATH_FUNCTIONS_NS), args);
    return xpe;
}
Also used : ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) StepExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr) ArrayList(java.util.ArrayList) Collection(java.util.Collection) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) ReverseStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep) Step(org.eclipse.wst.xml.xpath2.processor.internal.ast.Step) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) AnyKindTest(org.eclipse.wst.xml.xpath2.processor.internal.ast.AnyKindTest) XPathExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)

Example 3 with AxisStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep in project webtools.sourceediting by eclipse.

the class DefaultEvaluator method visit.

/**
 * visit axis step.
 *
 * @param e
 *            is the axis step.
 * @return a result sequence
 */
public Object visit(AxisStep e) {
    ResultSequence rs = (ResultSequence) e.step().accept(this);
    if (e.predicate_count() == 0)
        return rs;
    // I take it predicates are logical ANDS...
    Focus original_focus = focus();
    // go through all predicates
    for (Iterator i = e.iterator(); i.hasNext(); ) {
        // empty results... get out of here ? XXX
        if (rs.size() == 0)
            break;
        set_focus(new Focus(rs));
        rs = do_predicate((Collection) i.next());
    }
    // restore focus [context switching ;D ]
    set_focus(original_focus);
    return rs;
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) Focus(org.eclipse.wst.xml.xpath2.processor.internal.Focus) ListIterator(java.util.ListIterator) Iterator(java.util.Iterator) Collection(java.util.Collection)

Example 4 with AxisStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep in project webtools.sourceediting by eclipse.

the class Normalizer method visit.

/**
 * @param e
 *            is the axis step.
 * @return e
 */
public Object visit(AxisStep e) {
    Step s = (Step) e.step().accept(this);
    e.set_step(s);
    printCollExprs(e.iterator());
    return e;
}
Also used : AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) ReverseStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep) Step(org.eclipse.wst.xml.xpath2.processor.internal.ast.Step)

Aggregations

AxisStep (org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep)3 ForwardStep (org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep)3 ReverseStep (org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep)3 Step (org.eclipse.wst.xml.xpath2.processor.internal.ast.Step)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 AnyKindTest (org.eclipse.wst.xml.xpath2.processor.internal.ast.AnyKindTest)2 StepExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr)2 XPathExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)2 Iterator (java.util.Iterator)1 ListIterator (java.util.ListIterator)1 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)1 Focus (org.eclipse.wst.xml.xpath2.processor.internal.Focus)1 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)1