View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   //checkstyle: Checks Java source code for adherence to a set of rules.
3   //Copyright (C) 2001-2004  Oliver Burn
4   //
5   //This library is free software; you can redistribute it and/or
6   //modify it under the terms of the GNU Lesser General Public
7   //License as published by the Free Software Foundation; either
8   //version 2.1 of the License, or (at your option) any later version.
9   //
10  //This library is distributed in the hope that it will be useful,
11  //but WITHOUT ANY WARRANTY; without even the implied warranty of
12  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  //Lesser General Public License for more details.
14  //
15  //You should have received a copy of the GNU Lesser General Public
16  //License along with this library; if not, write to the Free Software
17  //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ////////////////////////////////////////////////////////////////////////////////
19  package com.puppycrawl.tools.checkstyle.checks.coding.nestedfordepth;
20  
21  /**
22   * This Class contains no logic, but serves as test-input for the unit tests for the
23   * <code>NestedForDepthCheck</code>-checkstyle enhancement.
24   * @author Alexander Jesse
25   * @see com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck
26   */
27  public class InputNestedForDepth {
28  
29    /**
30     * Dummy method containing 5 layers of for-statements.
31     */
32    public void nestedForFiveLevel() {
33      int i = 0;
34      int i1 = 0;
35      int i2 = 0;
36      int i3 = 0;
37      int i4 = 0;
38      int i5 = 0;
39  
40      for (i1 = 0; i1 < 10; i1++) {
41        for (i2 = 0; i2 < 10; i2++) {
42          for (i3 = 0; i3 < 10; i3++) {
43            for (i4 = 0; i4 < 10; i4++) {
44              for (i5 = 0; i5 < 10; i5++) {
45                i += 1;
46              }
47              for (int i5a = 0; i5a < 10; i5a++) {
48                  i += 1;
49                }
50            }
51          }
52        }
53      }
54    }
55  }