src/share/classes/com/sun/codemodel/internal/JForEach.java

changeset 50
42dfec6871f6
parent 45
31822b475baa
     1.1 --- a/src/share/classes/com/sun/codemodel/internal/JForEach.java	Mon Apr 20 15:25:02 2009 -0700
     1.2 +++ b/src/share/classes/com/sun/codemodel/internal/JForEach.java	Mon May 04 21:10:41 2009 -0700
     1.3 @@ -33,17 +33,17 @@
     1.4   */
     1.5  public final class JForEach implements JStatement {
     1.6  
     1.7 -    private final JType type;
     1.8 -    private final String var;
     1.9 -    private JBlock body = null; // lazily created
    1.10 -    private final JExpression collection;
    1.11 +        private final JType type;
    1.12 +        private final String var;
    1.13 +        private JBlock body = null; // lazily created
    1.14 +        private final JExpression collection;
    1.15      private final JVar loopVar;
    1.16  
    1.17 -    public JForEach(JType vartype, String variable, JExpression collection) {
    1.18 +        public JForEach(JType vartype, String variable, JExpression collection) {
    1.19  
    1.20 -        this.type = vartype;
    1.21 -        this.var = variable;
    1.22 -        this.collection = collection;
    1.23 +                this.type = vartype;
    1.24 +                this.var = variable;
    1.25 +                this.collection = collection;
    1.26          loopVar = new JVar(JMods.forVar(JMod.NONE), type, var, collection);
    1.27      }
    1.28  
    1.29 @@ -51,24 +51,24 @@
    1.30      /**
    1.31       * Returns a reference to the loop variable.
    1.32       */
    1.33 -    public JVar var() {
    1.34 -        return loopVar;
    1.35 -    }
    1.36 +        public JVar var() {
    1.37 +                return loopVar;
    1.38 +        }
    1.39  
    1.40 -    public JBlock body() {
    1.41 -        if (body == null)
    1.42 -            body = new JBlock();
    1.43 -        return body;
    1.44 -    }
    1.45 +        public JBlock body() {
    1.46 +                if (body == null)
    1.47 +                        body = new JBlock();
    1.48 +                return body;
    1.49 +        }
    1.50  
    1.51 -    public void state(JFormatter f) {
    1.52 -        f.p("for (");
    1.53 -        f.g(type).id(var).p(": ").g(collection);
    1.54 -        f.p(')');
    1.55 -        if (body != null)
    1.56 -            f.g(body).nl();
    1.57 -        else
    1.58 -            f.p(';').nl();
    1.59 -    }
    1.60 +        public void state(JFormatter f) {
    1.61 +                f.p("for (");
    1.62 +                f.g(type).id(var).p(": ").g(collection);
    1.63 +                f.p(')');
    1.64 +                if (body != null)
    1.65 +                        f.g(body).nl();
    1.66 +                else
    1.67 +                        f.p(';').nl();
    1.68 +        }
    1.69  
    1.70  }

mercurial