Search in sources :

Example 1 with BinExpr

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

the class DefaultEvaluator method do_bin_args.

private Collection do_bin_args(BinExpr e) {
    ResultSequence one = (ResultSequence) e.left().accept(this);
    ResultSequence two = (ResultSequence) e.right().accept(this);
    Collection args = new ArrayList();
    args.add(one);
    args.add(two);
    return args;
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) ArrayList(java.util.ArrayList) Collection(java.util.Collection)

Example 2 with BinExpr

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

the class DefaultEvaluator method do_logic_exp.

private boolean[] do_logic_exp(BinExpr e) {
    Collection args = do_bin_args(e);
    Iterator argiter = args.iterator();
    ResultSequence one = (ResultSequence) argiter.next();
    ResultSequence two = (ResultSequence) argiter.next();
    boolean oneb = effective_boolean_value(one).value();
    boolean twob = effective_boolean_value(two).value();
    boolean[] res = { oneb, twob };
    return res;
}
Also used : ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) ListIterator(java.util.ListIterator) Iterator(java.util.Iterator) Collection(java.util.Collection)

Example 3 with BinExpr

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

the class Normalizer method make_convert_binop.

// fs:fname( fs:convert-operand( fn:data(ARG1), 1.0E0 ),
// fs:convert-operand( fn:data(ARG2), 1.0E0 )
// )
private XPathExpr make_convert_binop(BinExpr e, XPathExpr convarg, QName name) {
    Collection args = normalize_bin_args(e);
    XPathExpr[] args_arr = new XPathExpr[2];
    int j = 0;
    for (Iterator i = args.iterator(); i.hasNext(); ) {
        args_arr[j] = (XPathExpr) i.next();
        j++;
    }
    Collection argsfname = new ArrayList();
    for (j = 0; j < 2; j++) {
        XPathExpr arg = make_convert_operand(args_arr[j], convarg);
        argsfname.add(arg);
    }
    return make_function(name, argsfname);
}
Also used : Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) Collection(java.util.Collection) XPathExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)

Example 4 with BinExpr

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

the class Normalizer method make_logic_expr.

private BinExpr make_logic_expr(BinExpr e) {
    Collection normalized = normalize_bin_args(e);
    XPathNode[] nor_arr = new XPathNode[2];
    int j = 0;
    for (Iterator i = normalized.iterator(); i.hasNext(); ) {
        nor_arr[j] = (XPathNode) i.next();
        j++;
    }
    Collection args = new ArrayList();
    args.add(nor_arr[0]);
    e.set_left(make_function(new QName("fn", "boolean", FnFunctionLibrary.XPATH_FUNCTIONS_NS), args));
    args.clear();
    args.add(nor_arr[1]);
    e.set_right(make_function(new QName("fn", "boolean", FnFunctionLibrary.XPATH_FUNCTIONS_NS), args));
    return e;
}
Also used : QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) Collection(java.util.Collection) XPathNode(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathNode)

Example 5 with BinExpr

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

the class Normalizer method normalize_bin_args.

private Collection normalize_bin_args(BinExpr e) {
    Collection args = new ArrayList();
    XPathNode left = (XPathNode) e.left().accept(this);
    XPathNode right = (XPathNode) e.right().accept(this);
    args.add(left);
    args.add(right);
    return args;
}
Also used : ArrayList(java.util.ArrayList) Collection(java.util.Collection) XPathNode(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathNode)

Aggregations

Collection (java.util.Collection)5 ArrayList (java.util.ArrayList)4 Iterator (java.util.Iterator)3 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)2 XPathNode (org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathNode)2 ListIterator (java.util.ListIterator)1 XPathExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)1 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)1