aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-squid-java-plugin/test-resources/metrics/branches/SimpleBranches.java
blob: 50092f8641e2d1bb748eb3cc16ca35855b22f821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import java.util.ArrayList;

public class SimpleBranches {
	private int n;
	private String s;

	public SimpleBranches(int n, String s) {
		this.n = n;
		this.s = s;
	}

	public int getN() {
		return n;
	}

	public String getS() {
		return s;
	}

	private void simpleIf() {
		if (s.equals("road") && n != 1) {
			n++;
		}
	}
	
	private void ifWithOr() {
		if (s.equals("road") || n != 1) {
			n++;
		}
	}

	private void simpleSwitch() {
		switch (n) {
		case 1:
			break;
		case 2:
			break;
		default:
			break;
		}
	}
	
	private void simpleFor() {
		for (int i = 0; i < 4; i++) {
			int j = 4;
		}
		for (String toto : new ArrayList<String>()) {
			int k = 0;
		}
	}

}