1 package com.stateofflow.eclipse.metrics.calculators.levels;
2
3 final class Level {
4 private int level;
5 private MaximumLevel maximum = new MaximumLevel();
6
7 public Level() {
8 }
9
10 public Level(final Level toCopy) {
11 this.level = toCopy.level;
12 this.maximum = new MaximumLevel(toCopy.maximum);
13 }
14
15 public void decrease(final int delta) {
16 level -= delta;
17 }
18
19 public void decrement() {
20 decrease(1);
21 }
22
23 public int getClassMaximum() {
24 return maximum.getClassMaximum();
25 }
26
27 public int getMethodMaximum() {
28 return maximum.getMethodMaximum();
29 }
30
31 public void handleNestedClass(final Level inner) {
32 increase(inner.getClassMaximum());
33 decrease(inner.getClassMaximum());
34 }
35
36 public void increase(final int delta) {
37 level += delta;
38 maximum.takeMaximum(level);
39 }
40
41 public void increment() {
42 increase(1);
43 }
44
45 public void startMethod() {
46 level = 1;
47 maximum.startMethod();
48 }
49
50 public void startType() {
51 maximum.startType();
52 }
53 }
54