1   package com.puppycrawl.tools.checkstyle.checks.metrics.booleanexpressioncomplexity;
2   
3   public class InputBooleanExpressionComplexity {
4       private boolean _a = false; //boolean field
5       private boolean _b = false;
6       private boolean _c = false;
7       private boolean _d = false;
8       /*public method*/
9       public void foo() {
10          if (_a && _b || _c ^ _d) {
11          }
12  
13          if (((_a && (_b & _c)) || (_c ^ _d))) {
14          }
15  
16          if (_a && _b && _c) {
17          }
18  
19          if (_a & _b) {
20          }
21  
22          if (_a) {
23          }
24      }
25  
26      public boolean equals(Object object) {
27          new NestedClass() {
28              public void method() {
29                  new Settings(Settings.FALSE || Settings.FALSE || Settings.FALSE || _a || _b);
30              }
31              public void method2() {
32              }
33          };
34          return (((_a && (_b & _c)) || (_c ^ _d) || (_a && _d)));
35      }
36  
37      public boolean bitwise()
38      {
39          return (((_a & (_b & _c)) | (_c ^ _d) | (_a & _d)));
40      }
41  
42      public void notIgnoredMethodParameters()
43      {
44          new Settings(Settings.FALSE && Settings.FALSE && Settings.FALSE
45                  && Settings.TRUE && Settings.TRUE);
46          new Settings(Settings.FALSE || Settings.FALSE || Settings.FALSE
47                  || Settings.TRUE || Settings.TRUE);
48      }
49  
50      public void ignoredMethodParameters()
51      {
52          new Settings(Settings.RESIZABLE | Settings.SCROLLBARS | Settings.LOCATION_BAR
53                  | Settings.MENU_BAR | Settings.TOOL_BAR);
54          new Settings(Settings.RESIZABLE & Settings.SCROLLBARS & Settings.LOCATION_BAR
55                  & Settings.MENU_BAR & Settings.TOOL_BAR);
56          new Settings(Settings.RESIZABLE ^ Settings.SCROLLBARS ^ Settings.LOCATION_BAR
57                  ^ Settings.MENU_BAR ^ Settings.TOOL_BAR);
58      }
59  
60      private class Settings {
61          public final static int RESIZABLE = 1;
62          public final static int SCROLLBARS = 2;
63          public final static int LOCATION_BAR = 3;
64          public final static int MENU_BAR = 4;
65          public final static int TOOL_BAR = 5;
66  
67          public final static boolean TRUE = true;
68          public final static boolean FALSE = false;
69  
70          public Settings(int flag)
71          {
72          }
73  
74          public Settings(boolean flag)
75          {
76          }
77      }
78  
79      abstract class NestedClass {
80          public abstract void method();
81          public abstract void method2();
82      }
83  }