1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="BooleanExpressionComplexity"> 5 <property name="tokens" value="BXOR,LAND,LOR"/> 6 </module> 7 </module> 8 </module> 9 */ 10 package com.puppycrawl.tools.checkstyle.checks.metrics.booleanexpressioncomplexity; 11 12 // xdoc section -- start 13 public class Example3 14 { 15 public static void main(String ... args) 16 { 17 boolean a = true; 18 boolean b = false; 19 20 boolean c = (a & b) | (b ^ a); // OK, 1(^) = 1 (max allowed 3) 21 22 boolean d = (a & b) | (b ^ a) | (a ^ b); 23 // OK above, 1(^) + 1(^) = 2, & and | are ignored here 24 25 boolean e = a ^ (a || b) ^ (b || a) & (a | b); 26 // violation above, 'Boolean expression complexity is 4 (max allowed is 3)' 27 // 1(^) + 1(||) + 1(^) + 1(||) = 4, & and | are ignored here 28 } 29 } 30 // xdoc section -- end