java.lang.Object org.supermind.crawl.util.ChainedScatterTable
public class ChainedScatterTable
A fixed-size chained scatter table that implements the clock/second-chance algorithm for purging entries.
Implemented for storing longs. The 16 most significant bits are used as the hashkey, whilst the 48 least significant bits are used as the value.
Nested Class Summary | |
---|---|
static class |
ChainedScatterTable.Entry
|
Field Summary | |
---|---|
protected ChainedScatterTable.Entry[] |
array
|
protected int |
clockIndex
|
protected int |
count
|
protected static java.util.logging.Logger |
LOG
Logger. |
protected ScatterPurger |
purger
|
Constructor Summary | |
---|---|
ChainedScatterTable(ScatterPurger purger)
|
Method Summary | |
---|---|
void |
clear()
|
boolean |
contains(long chksm)
|
int |
find(long obj)
|
protected int |
getAddressToEvict()
This method has side-effect of incrementing clockIndex. |
protected int |
hash(long obj)
Use 32 most sig. |
int |
insert(long value)
|
long |
reconstitute(int idx,
long value)
Reconstitute the full long given an index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ChainedScatterTable.Entry[] array
protected int clockIndex
protected int count
protected static java.util.logging.Logger LOG
protected ScatterPurger purger
Constructor Detail |
---|
public ChainedScatterTable(ScatterPurger purger)
Method Detail |
---|
public void clear()
public boolean contains(long chksm)
public int find(long obj)
protected int getAddressToEvict()
protected int hash(long obj)
obj
-
public int insert(long value)
public long reconstitute(int idx, long value)
idx
-