private static class FrequencyTrackingRingBuffer.IntBag extends java.lang.Object implements Accountable
Modifier and Type | Field and Description |
---|---|
private static long |
BASE_RAM_BYTES_USED |
private int[] |
freqs |
private int[] |
keys |
private int |
mask |
Constructor and Description |
---|
IntBag(int maxSize) |
Modifier and Type | Method and Description |
---|---|
(package private) int |
add(int key)
Increment the frequency of the given key by 1 and return its new frequency.
|
(package private) java.util.Map<java.lang.Integer,java.lang.Integer> |
asMap() |
private static boolean |
between(int chainStart,
int chainEnd,
int slot)
Given a chain of occupied slots between
chainStart
and chainEnd , return whether slot is
between the start and end of the chain. |
(package private) int |
frequency(int key)
Return the frequency of the give key in the bag.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
private void |
relocateAdjacentKeys(int freeSlot) |
(package private) boolean |
remove(int key)
Decrement the frequency of the given key by one, or do nothing if the
key is not present in the bag.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildResources
private static final long BASE_RAM_BYTES_USED
private final int[] keys
private final int[] freqs
private final int mask
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
int frequency(int key)
int add(int key)
boolean remove(int key)
private void relocateAdjacentKeys(int freeSlot)
private static boolean between(int chainStart, int chainEnd, int slot)
chainStart
and chainEnd
, return whether slot
is
between the start and end of the chain.java.util.Map<java.lang.Integer,java.lang.Integer> asMap()