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
-
public class NonZeroCachingCounter extends Counter
-
-
Constructor Summary
Constructors Constructor Description NonZeroCachingCounter(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the counter by setting all values to zero.org.eclipse.collections.api.list.primitive.IntList
getNonZeroIndices()
Returns a set of indices at which the count is non-zero.int
getNonZeroSize()
Returns the number of indices with non-zero counts.org.eclipse.collections.api.list.primitive.IntList
getNonZeroValues()
Returns a set of non-zero count values in this counter.boolean
hasNonZeros()
Checks if all indices have zero counts and returns a boolean as result.int
incrementAtIndex(int index, int delta)
void
setAtIndex(int index, int newValue)
-
Methods inherited from class edu.berkeley.cs.jqf.fuzz.util.Counter
get, getAtIndex, increment, increment, increment1, size
-
-
-
-
Method Detail
-
clear
public void clear()
Description copied from class:Counter
Clears the counter by setting all values to zero.
-
incrementAtIndex
public int incrementAtIndex(int index, int delta)
- Overrides:
incrementAtIndex
in classCounter
-
getNonZeroSize
public int getNonZeroSize()
Description copied from class:Counter
Returns the number of indices with non-zero counts.- Overrides:
getNonZeroSize
in classCounter
- Returns:
- the number of indices with non-zero counts
-
hasNonZeros
public boolean hasNonZeros()
Description copied from class:Counter
Checks if all indices have zero counts and returns a boolean as result.- Overrides:
hasNonZeros
in classCounter
- Returns:
true
if some indices have non-zero counts, otherwisefalse
.
-
getNonZeroIndices
public org.eclipse.collections.api.list.primitive.IntList getNonZeroIndices()
Description copied from class:Counter
Returns 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:
getNonZeroIndices
in 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:Counter
Returns a set of non-zero count values in this counter.- Overrides:
getNonZeroValues
in classCounter
- Returns:
- a set of non-zero count values in this counter.
-
setAtIndex
public void setAtIndex(int index, int newValue)
- Overrides:
setAtIndex
in classCounter
-
-