net.sourceforge.cobertura.coveragedata.countermaps
Class AtomicCounterMap<T>
java.lang.Object
net.sourceforge.cobertura.coveragedata.countermaps.AtomicCounterMap<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
- CounterMap<T>, HasBeenInstrumented
public class AtomicCounterMap<T>
- extends java.lang.Object
- implements CounterMap<T>, HasBeenInstrumented
Thread-safe implementation of map that counts number of keys (like multi-set)
- Author:
- ptab
Field Summary |
private java.util.concurrent.ConcurrentMap<T,java.util.concurrent.atomic.AtomicInteger> |
counters
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
counters
private final java.util.concurrent.ConcurrentMap<T,java.util.concurrent.atomic.AtomicInteger> counters
AtomicCounterMap
public AtomicCounterMap()
incrementValue
public final void incrementValue(T key,
int inc)
- Specified by:
incrementValue
in interface CounterMap<T>
incrementValue
public final void incrementValue(T key)
- Specified by:
incrementValue
in interface CounterMap<T>
getValue
public final int getValue(T key)
- Specified by:
getValue
in interface CounterMap<T>
getFinalStateAndCleanIt
public java.util.Map<T,java.lang.Integer> getFinalStateAndCleanIt()
- Specified by:
getFinalStateAndCleanIt
in interface CounterMap<T>
getSize
public int getSize()