T - type of SimpleDataStructure objects stored in this bucketclass 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()Remove all entries from this bucket. |
Set<T> | getEntries()Retrieve all routing table entries stored in the bucket. |
void | getEntries(SelectionCollector<T> collector)Add all entries in this bucket to the provided 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)
context - the router contextbegin - the range beginend - the range endmax - the maximum entries per buckettrimmer - the trim strategypublic boolean add(T peer)
add in interface KBucket<T extends SimpleDataStructure>public void clear()
KBucketclear in interface KBucket<T extends SimpleDataStructure>public Set<T> getEntries()
KBucketgetEntries in interface KBucket<T extends SimpleDataStructure>public void getEntries(SelectionCollector<T> collector)
KBucketgetEntries in interface KBucket<T extends SimpleDataStructure>collector - the collector to add entries topublic int getKeyCount()
KBucketgetKeyCount in interface KBucket<T extends SimpleDataStructure>public long getLastChanged()
getLastChanged in interface KBucket<T extends SimpleDataStructure>public int getRangeBegin()
KBucketgetRangeBegin in interface KBucket<T extends SimpleDataStructure>public int getRangeEnd()
KBucketgetRangeEnd in interface KBucket<T extends SimpleDataStructure>public boolean remove(T peer)
KBucketremove in interface KBucket<T extends SimpleDataStructure>public void setLastChanged()
setLastChanged in interface KBucket<T extends SimpleDataStructure>