View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.typeresolution.testdata;
5   
6   import java.util.List;
7   
8   public class Operators {
9   	public void unaryLogicalOperators() {
10  		boolean t;
11  		t = !true;
12  		t = !false;
13  	}
14  	public void binaryLogicalOperators() {
15  		boolean t;
16  		t = true | false;
17  		t = true & false;
18  		t = true ^ false;
19  		t = true && false;
20  		t = true || false;
21  		t = 1 > 1;
22  		t = 1 >= 1;
23  		t = 1 == 1;
24  		t = 1 != 1;
25  		t = 1 <= 1;
26  		t = 1 < 1;
27  		t = this instanceof List;
28  		t = this instanceof Operators;
29  	}
30  	public void unaryNumericOperators() {
31  		double t;
32  		t = +1;
33  		t = -1;
34  		t++;
35  		t--;
36  		++t;
37  		--t;
38  	}
39  	public void binaryNumericOperators() {
40  		long t;
41  		t = 1 + 1;
42  		t = 1 - 1;
43  		t = 1 / 1;
44  		t = 1 * 1;
45  		t = 1 % 1;
46  		t = 1 << 1;
47  		t = 1 >> 1;
48  		t = 1 >>> 1;
49  	}
50  	public void assignmentOperators() {
51  		long t;
52  		t = 1;
53  		t *= 1;
54  		t /= 1;
55  		t %= 1;
56  		t += 1;
57  		t -= 1;
58  		t <<= 1;
59  		t >>= 1;
60  		t >>>= 1;
61  		t &= 1;
62  		t ^= 1;
63  		t |= 1;
64  	}
65  }