class KBucketImpl<T extends SimpleDataStructure> extends Object implements KBucket<T>
Constructor and Description |
---|
KBucketImpl(I2PAppContext context,
int begin,
int end,
int max,
KBucketTrimmer<T> trimmer)
All entries in this bucket will have at least one bit different
from us in the range [begin, end] inclusive.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T peer)
Sets last-changed if rv is true OR if the peer is already present.
|
void |
clear() |
Set<T> |
getEntries()
Retrieve all routing table entries stored in the bucket
|
void |
getEntries(SelectionCollector<T> collector) |
int |
getKeyCount()
Number of keys already contained in this kbucket
|
long |
getLastChanged()
The last-changed timestamp, which actually indicates last-added or last-seen.
|
int |
getRangeBegin()
Lowest order high bit for difference keys.
|
int |
getRangeEnd()
Highest high bit for the difference keys.
|
boolean |
remove(T peer)
Remove the key from the bucket
|
void |
setLastChanged()
Update the last-changed timestamp to now.
|
String |
toString() |
public KBucketImpl(I2PAppContext context, int begin, int end, int max, KBucketTrimmer<T> trimmer)
public int getRangeBegin()
KBucket
getRangeBegin
in interface KBucket<T extends SimpleDataStructure>
public int getRangeEnd()
KBucket
getRangeEnd
in interface KBucket<T extends SimpleDataStructure>
public int getKeyCount()
KBucket
getKeyCount
in interface KBucket<T extends SimpleDataStructure>
public Set<T> getEntries()
KBucket
getEntries
in interface KBucket<T extends SimpleDataStructure>
public void getEntries(SelectionCollector<T> collector)
getEntries
in interface KBucket<T extends SimpleDataStructure>
public void clear()
clear
in interface KBucket<T extends SimpleDataStructure>
public boolean add(T peer)
add
in interface KBucket<T extends SimpleDataStructure>
public boolean remove(T peer)
KBucket
remove
in interface KBucket<T extends SimpleDataStructure>
public void setLastChanged()
setLastChanged
in interface KBucket<T extends SimpleDataStructure>
public long getLastChanged()
getLastChanged
in interface KBucket<T extends SimpleDataStructure>