Package edu.berkeley.cs.jqf.fuzz.util
Class NonZeroCachingCounter
java.lang.Object
edu.berkeley.cs.jqf.fuzz.util.Counter
edu.berkeley.cs.jqf.fuzz.util.NonZeroCachingCounter
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the counter by setting all values to zero.org.eclipse.collections.api.list.primitive.IntListReturns a set of indices at which the count is non-zero.intReturns the number of indices with non-zero counts.org.eclipse.collections.api.list.primitive.IntListReturns a set of non-zero count values in this counter.booleanChecks if all indices have zero counts and returns a boolean as result.intincrementAtIndex(int index, int delta) voidsetAtIndex(int index, int newValue) Methods inherited from class edu.berkeley.cs.jqf.fuzz.util.Counter
get, getAtIndex, increment, increment, increment1, size
-
Constructor Details
-
NonZeroCachingCounter
public NonZeroCachingCounter(int size)
-
-
Method Details
-
clear
public void clear()Description copied from class:CounterClears the counter by setting all values to zero. -
incrementAtIndex
public int incrementAtIndex(int index, int delta) - Overrides:
incrementAtIndexin classCounter
-
getNonZeroSize
public int getNonZeroSize()Description copied from class:CounterReturns the number of indices with non-zero counts.- Overrides:
getNonZeroSizein classCounter- Returns:
- the number of indices with non-zero counts
-
hasNonZeros
public boolean hasNonZeros()Description copied from class:CounterChecks if all indices have zero counts and returns a boolean as result.- Overrides:
hasNonZerosin classCounter- Returns:
trueif some indices have non-zero counts, otherwisefalse.
-
getNonZeroIndices
public org.eclipse.collections.api.list.primitive.IntList getNonZeroIndices()Description copied from class:CounterReturns a set of indices at which the count is non-zero.Note that indices are different from keys, in that multiple keys can map to the same index due to hash collisions.
- Overrides:
getNonZeroIndicesin classCounter- Returns:
- a set of indices at which the count is non-zero
-
getNonZeroValues
public org.eclipse.collections.api.list.primitive.IntList getNonZeroValues()Description copied from class:CounterReturns a set of non-zero count values in this counter.- Overrides:
getNonZeroValuesin classCounter- Returns:
- a set of non-zero count values in this counter.
-
setAtIndex
public void setAtIndex(int index, int newValue) - Overrides:
setAtIndexin classCounter
-