Examples of EvalContext


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

    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)) {
                return SimplePathInterpreter.interpretSimpleExpressionPath(
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().getAbsoluteRootContext();
        }
        else {
            rootContext = new InitialContext(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().getAbsoluteRootContext();
        }
        else {
            rootContext = new InitialContext(context);
View Full Code Here

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

    public CoreOperationUnion(Expression args[]) {
        super(args);
    }

    public Object computeValue(EvalContext context) {
        EvalContext argCtxs[] = new EvalContext[args.length];
        for (int i = 0; i < args.length; i++) {
            Object value = args[i].compute(context);
            if (value instanceof EvalContext) {
                argCtxs[i] = (EvalContext) value;
            }
View Full Code Here

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

    private void prepareList() {
        list = new ArrayList();
        HashSet set = new HashSet();
        for (int i = 0; i < contexts.length; i++) {
            EvalContext ctx = (EvalContext) contexts[i];
            while (ctx.nextSet()) {
                while (ctx.nextNode()) {
                    NodePointer ptr = ctx.getCurrentNodePointer();
                    if (!set.contains(ptr)) {
                        ptr = (NodePointer) ptr.clone();
                        list.add(ptr);
                        set.add(ptr);
                    }
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()) {
                NodePointer ptr = (NodePointer) ctx.next();
                String str = ptr.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()) {
                NodePointer ptr = (NodePointer) ctx.next();
                return ptr.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()) {
                NodePointer ptr = (NodePointer) ctx.next();
                return ptr.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.hasNext()) {
                NodePointer ptr = (NodePointer) ctx.next();
                sum += InfoSetUtil.doubleValue(ptr);
            }
            return new Double(sum);
        }
        throw new JXPathException(
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.