Package soot.jimple.infoflow.collect
Class ConcurrentCountingMap<T>
java.lang.Object
soot.jimple.infoflow.collect.ConcurrentCountingMap<T>
- All Implemented Interfaces:
ConcurrentMap<T,,Integer> Map<T,Integer>
A map that associates an element with a number. This map will never return a
null value, but will pre-initialize all counters with a default value of
zero.
- Author:
- Steven Arzt
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) intDecrements the counter associated with the given value by oneentrySet()getByValue(int value) Gets all keys that have the given value.intGets the current state of the change counter.intIncrements the counter associated with the given value by oneintIncrements the counter associated with the given value by the given deltabooleanisEmpty()keySet()voidputIfAbsent(T key, Integer value) booleanbooleanvoidsetLockingMode(ConcurrentCountingMap.LockingMode lockingMode) Sets how whether and how this class shall perform lockingintsize()snapshot()Creates a snapshot of this mapsnapshot(Collection<T> subset) Creates a partial snapshot of this mapvalues()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Constructor Details
-
ConcurrentCountingMap
public ConcurrentCountingMap() -
ConcurrentCountingMap
public ConcurrentCountingMap(int size) -
ConcurrentCountingMap
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<T,Integer>
-
containsValue
- Specified by:
containsValuein interfaceMap<T,Integer>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<T,Integer> - Specified by:
putIfAbsentin interfaceMap<T,Integer>
-
remove
-
replace
-
replace
-
increment
Increments the counter associated with the given value by one- Parameters:
key- The key of the value for which to increment the counter- Returns:
- The new counter value
-
increment
Increments the counter associated with the given value by the given delta- Parameters:
key- The key of the value for which to increment the counterdelta- The delta by which to increment the counter- Returns:
- The new counter value
-
decrement
Decrements the counter associated with the given value by one- Parameters:
key- The key of the value for which to decrement the counter- Returns:
- The new counter value
-
getByValue
Gets all keys that have the given value. Note that values are free to change at any time, so the set returned by this method may contain keys that have other values as well in case they were mutated by a different thread while this method was running.- Parameters:
value- The expected value- Returns:
- A set with all keys that have the given value
-
setLockingMode
Sets how whether and how this class shall perform locking- Parameters:
lockingMode- The new locking mode
-
snapshot
Creates a snapshot of this map- Returns:
- A copy of the current state of this map
-
snapshot
Creates a partial snapshot of this map- Parameters:
subset- The subset of element for which to create a partial snapshot- Returns:
- A copy of the current state of this map
-
getChangeCounter
public int getChangeCounter()Gets the current state of the change counter. This counter is modified whenever the contents of the map are changed.- Returns:
- The current value of the change counter
-