Examples of EvalContext


Examples of org.apache.commons.jxpath.ri.EvalContext

        if (v == null) {
            return ZERO;
        }
        if (v instanceof EvalContext) {
            double sum = 0.0;
            EvalContext ctx = (EvalContext) v;
            while (ctx.hasNext()) {
                NodePointer ptr = (NodePointer) ctx.next();
                sum += InfoSetUtil.doubleValue(ptr);
            }
            return new Double(sum);
        }
        throw new JXPathException(
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

    /**
     * Walks an expression path (a path that starts with an expression)
     */
    protected Object expressionPath(EvalContext evalContext, boolean firstMatch){
        Object value = expression.compute(evalContext);
        EvalContext context;
        if (value instanceof InitialContext){
            // This is an optimization. We can avoid iterating through a collection
            // if the context bean is in fact one.
            context = (InitialContext)value;
        }
        else if (value instanceof EvalContext){
            // UnionContext will collect all values from the "value" context
            // and treat the whole thing as a big collection.
            context = new UnionContext(evalContext, new EvalContext[]{(EvalContext)value});
        }
        else {
            context = evalContext.getRootContext().getConstantContext(value);
        }

        if (firstMatch && isSimpleExpressionPath() &&
                !(context instanceof UnionContext)){
            EvalContext ctx = context;
            NodePointer ptr = (NodePointer)ctx.getSingleNodePointer();
            if (ptr != null &&
                    (ptr.getIndex() == NodePointer.WHOLE_COLLECTION ||
                     predicates == null || predicates.length == 0)){
                NodePointer pointer = SimplePathInterpreter.
                    interpretPredicates(evalContext, ptr, predicates);
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

        return buffer.toString();
    }

    public Object compute(EvalContext context){
        // Create a chain of contexts
        EvalContext rootContext;
        if (isAbsolute()){
            rootContext = context.getRootContext();
        }
        else {
            rootContext = context;
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

    }


    public Object computeValue(EvalContext context){
        // Create a chain of contexts
        EvalContext rootContext;
        if (isAbsolute()) {
            rootContext = context.getRootContext();
        }
        else {
            rootContext = context;
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

        Object value = arg1.compute(context);
        if (value instanceof NodePointer){
            value = ((NodePointer)value).getValue();
        }
        if (value instanceof EvalContext){
            EvalContext ctx = (EvalContext)value;
            while(ctx.hasNext()){
                ctx.next();
                count++;
            }
        }
        else if (value instanceof Collection){
            count = ((Collection)value).size();
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

            return context.getCurrentNodePointer();
        }
        assertArgCount(1);
        Object set = getArg1().compute(context);
        if (set instanceof EvalContext){
            EvalContext ctx = (EvalContext)set;
            if (ctx.hasNext()){
                ctx.next();
                String str = ctx.getCurrentNodePointer().getNamespaceURI();
                return str == null ? "" : str;
            }
        }
        return "";
    }
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

            return context.getCurrentNodePointer();
        }
        assertArgCount(1);
        Object set = getArg1().compute(context);
        if (set instanceof EvalContext){
            EvalContext ctx = (EvalContext)set;
            if (ctx.hasNext()){
                ctx.next();
                return ctx.getCurrentNodePointer().getName().getName();
            }
        }
        return "";
    }
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

            return context.getCurrentNodePointer();
        }
        assertArgCount(1);
        Object set = getArg1().compute(context);
        if (set instanceof EvalContext){
            EvalContext ctx = (EvalContext)set;
            if (ctx.hasNext()){
                ctx.next();
                return ctx.getCurrentNodePointer().getExpandedName().toString();
            }
        }
        return "";
    }
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

        if (v == null){
            return ZERO;
        }
        else if (v instanceof EvalContext){
            double sum = 0.0;
            EvalContext ctx = (EvalContext)v;
            while (ctx.nextSet()){
                while (ctx.nextNode()){
                    sum += InfoSetUtil.doubleValue(ctx.getCurrentNodePointer());
                }
            }
            return new Double(sum);
        }
        throw new JXPathException("Invalid argument type for 'sum': "
View Full Code Here

Examples of org.apache.commons.jxpath.ri.EvalContext

     * Computes <code>"left | right"<code>
     */
    protected Object union(EvalContext context, Expression left, Expression right){
        Object l = left.compute(context);
        Object r = right.compute(context);
        EvalContext lctx;
        if (l instanceof EvalContext){
            lctx = (EvalContext)l;
        }
        else {
            lctx = context.getRootContext().getConstantContext(l);
        }
        EvalContext rctx;
        if (r instanceof EvalContext){
            rctx = (EvalContext)r;
        }
        else {
            rctx = context.getRootContext().getConstantContext(r);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.