Examples of EvalContext


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

        if (!prepared) {
            prepared = true;
            BasicNodeSet nodeSet = (BasicNodeSet) getNodeSet();
            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)) {
                            nodeSet.add(ptr);
                            set.add(ptr);
                        }
                    }
View Full Code Here

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

     * fails, chop off another step and repeat. If it finds more than one
     * location - return null.
     * </p>
     */
    private Pointer searchForPath(EvalContext context) {
        EvalContext ctx = buildContextChain(context, steps.length, true);
        Pointer pointer = ctx.getSingleNodePointer();
       
        if (pointer != null) {
            return pointer;
        }
       
        for (int i = steps.length; --i > 0;) {
            if (!isSimpleStep(steps[i])) {
                return null;
            }
            ctx = buildContextChain(context, i, true);
            if (ctx.hasNext()) {
                Pointer partial = (Pointer) ctx.next();
                if (ctx.hasNext()) {
                    // If we find another location - the search is
                    // ambiguous, so we report failure
                    return null;
                }
                if (partial instanceof NodePointer) {
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 str == null ? "" : str;
        }
        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 ptr.getName().getName();
        }
        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 ptr.getName().toString();
        }
        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().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

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

    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 NodeSetContext)) {
            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
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.