Counter.java |
1 package com.stateofflow.eclipse.metrics.util; 2 3 public final class Counter { 4 private int value; 5 6 public Counter() { 7 this(0); 8 } 9 10 public Counter(final int initialValue) { 11 value = initialValue; 12 } 13 14 public void add(final int dValue) { 15 value += dValue; 16 } 17 18 public int getValue() { 19 return value; 20 } 21 22 public String toString() { 23 return Integer.toString(value); 24 } 25 26 public void increment() { 27 add(1); 28 } 29 }