diff --git a/.settings/edu.umd.cs.findbugs.core.prefs b/.settings/edu.umd.cs.findbugs.core.prefs index 73ac78d870c97eac5872c26af03871bd22cd45fe..0e512fef4944ce7249ac549a372a1cb489147624 100644 --- a/.settings/edu.umd.cs.findbugs.core.prefs +++ b/.settings/edu.umd.cs.findbugs.core.prefs @@ -1,5 +1,5 @@ #FindBugs User Preferences -#Wed Jan 28 07:11:46 CET 2015 +#Tue Mar 17 16:58:49 CET 2015 detector_threshold=3 effort=max excludefilter0=.fbExcludeFilterFile|true diff --git a/src/main/java/teetime/util/CounterState.java b/src/main/java/teetime/util/CounterState.java new file mode 100644 index 0000000000000000000000000000000000000000..983e909c8c99aa807ba31231ab9c6ac087636fac --- /dev/null +++ b/src/main/java/teetime/util/CounterState.java @@ -0,0 +1,35 @@ +package teetime.util; + +import java.util.Set; + +public class CounterState { + + private final Set<CounterState> allCounters; + + private int value; + + public CounterState(final Set<CounterState> allCounters) { + super(); + this.allCounters = allCounters; + } + + // value operation (+) + public int inc(final int rightSummand) { + value += rightSummand; + return value; + } + + public int getValue() { + return value; + } + + // combine operation (+) + public int getThreadGlobalValue() { + int sum = 0; + for (CounterState counterState : allCounters) { + sum += counterState.getValue(); + } + return sum; + } + +}