Package cambridge.runtime

Examples of cambridge.runtime.Iter


            iter.next();
        }
    }

    private void iterateBoolean(Map<String, Object> bindings, TagNode tag, Writer out, boolean[] o) throws IOException, TemplateEvaluationException {
        Iter iter = new Iter();
        bindings.put(getIterObjectName(), iter);
        for (boolean o1 : o) {
            bindings.put(getCurrentObjectName(), o1);
            tag.execute(bindings, out);
            iter.next();
        }
    }
View Full Code Here


    }

    @Override
    public void doExecute(Map<String, Object> bindings, TagNode tag, Writer out) throws TemplateEvaluationException, IOException {
        try {
            Iter iter = new Iter();
            while (expression.asBoolean(bindings)) {
                bindings.put(Expressions.ITER_OBJECT, iter);
                tag.execute(bindings, out);
                iter.next();
            }
        } catch (ExpressionEvaluationException e) {
            throw new TemplateEvaluationException(e, "Could not execute the expression: " +
                    e.getMessage() + ", on line: " + tag.getBeginLine() + ", column: " +
                    tag.getBeginColumn(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName());
View Full Code Here

         if (f instanceof Form) {
            Form form = (Form) f;

            Object t = bindings.get(Expressions.CURRENT_OBJECT);
            Super ts = (Super) bindings.get(Expressions.PARENT_OBJECT);
            Iter iter = (Iter) bindings.get(Expressions.ITER_OBJECT);

            Super s = null;

            if (t != null) {
               s = new Super(t, ts, iter);
View Full Code Here

    }

    public final void execute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException {
        Object t = context.get(getCurrentObjectName());
        Super ts = (Super) context.get(getParentObjectName());
        Iter iter = (Iter) context.get(getIterObjectName());

        Super s = null;

        if (t != null) {
            s = new Super(t, ts, iter);
View Full Code Here

    }

    @Override
    public void doExecute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException {
        try {
            Iter iter = new Iter();
            int n = number.asInt(context);
            for (int i = 0; i != n; i++) {
              if (i == n - 1) {
                iter.setLast();
                }

                context.put(Expressions.CURRENT_OBJECT, i);
                context.put(Expressions.ITER_OBJECT, iter);
                tag.execute(context, out);
                iter.next();
            }
        } catch (ExpressionEvaluationException e) {
            throw new TemplateEvaluationException(e, "Could not execute the expression: " +
                    e.getMessage() + ", on line: " + tag.getBeginLine() + ", column: " +
                    tag.getBeginColumn(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName());
View Full Code Here

            throw new TemplateEvaluationException(e, "Could not execute the expression: " + e.getMessage(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName());
        }
    }

    private void iterateIterable(ExpressionContext context, TagNode tag, Writer out, Iterable<Object> o) throws IOException, TemplateEvaluationException {
        Iter iter = new Iter();
        context.put(getIterObjectName(), iter);
        Iterator<?> it = o.iterator();
        while (it.hasNext()) {
          Object o1 = it.next();

          if (!it.hasNext()) {
            iter.setLast();
            }

            context.put(getCurrentObjectName(), o1);
            tag.execute(context, out);
            iter.next();
        }
    }
View Full Code Here

         if (f instanceof Form) {
            Form form = (Form) f;

            Object t = bindings.get(Expressions.CURRENT_OBJECT);
            Super ts = (Super) bindings.get(Expressions.PARENT_OBJECT);
            Iter iter = (Iter) bindings.get(Expressions.ITER_OBJECT);

            Super s = null;

            if (t != null) {
               s = new Super(t, ts, iter);
View Full Code Here

            iter.next();
        }
    }

    private void iterateArray(ExpressionContext context, TagNode tag, Writer out, Object[] o) throws IOException, TemplateEvaluationException {
        Iter iter = new Iter();
        context.put(getIterObjectName(), iter);
        for (int i=0; i<o.length; i++) {
          if (i == o.length-1)
            iter.setLast();

            context.put(getCurrentObjectName(), o[i]);
            tag.execute(context, out);
            iter.next();
        }
    }
View Full Code Here

            iter.next();
        }
    }

    private void iterateInt(ExpressionContext context, TagNode tag, Writer out, int[] o) throws IOException, TemplateEvaluationException {
        Iter iter = new Iter();
        context.put(getIterObjectName(), iter);
        for (int i=0; i<o.length; i++) {
          if (i == o.length-1)
            iter.setLast();

            context.put(getCurrentObjectName(), o[i]);
            tag.execute(context, out);
            iter.next();
        }
    }
View Full Code Here

            iter.next();
        }
    }

    private void iterateFloat(ExpressionContext context, TagNode tag, Writer out, float[] o) throws IOException, TemplateEvaluationException {
        Iter iter = new Iter();
        context.put(getIterObjectName(), iter);
        for (int i=0; i<o.length; i++) {
          if (i == o.length-1)
            iter.setLast();

            context.put(getCurrentObjectName(), o[i]);
            tag.execute(context, out);
            iter.next();
        }
    }
View Full Code Here

TOP

Related Classes of cambridge.runtime.Iter

Copyright © 2018 www.massapicom. 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.