## net.i2p.router.networkdb.kademlia
Interface KBucket

All Known Implementing Classes:
  KBucketImpl

interface KBucket

Group, without inherent ordering, a set of keys a certain distance away from a local key, using XOR as the distance metric

Method Summary
`int` `add(Hash key)` Add the peer to the bucket
`Hash` `generateRandomKey()` Generate a random key that would go inside this bucket
`java.util.Set` `getEntries()` Retrieve all routing table entries stored in the bucket
`void` `getEntries(SelectionCollector collector)`
`java.util.Set` `getEntries(java.util.Set toIgnoreHashes)` Retrieve hashes stored in the bucket, excluding the ones specified
`int` `getKeyCount()` Number of keys already contained in this kbuckey
`Hash` `getLocal()`
`int` `getRangeBegin()` lowest order high bit for difference keys
`int` `getRangeEnd()` highest high bit for the difference keys
`boolean` `remove(Hash key)` Remove the key from the bucket
`void` `setEntries(java.util.Set entries)` Fill the bucket with entries
`void` `setRange(int lowOrderBitLimit, int highOrderBitLimit)` Set the range low and high bits for difference keys
`boolean` `shouldContain(Hash key)` whether or not the key qualifies as part of this bucket

Method Detail

### getRangeBegin

    public int getRangeBegin()

  lowest order high bit for difference keys

### getRangeEnd

    public int getRangeEnd()

  highest high bit for the difference keys

### setRange

    public void setRange(int lowOrderBitLimit,
                         int highOrderBitLimit)

  Set the range low and high bits for difference keys

### getKeyCount

    public int getKeyCount()

  Number of keys already contained in this kbuckey

### shouldContain

    public boolean shouldContain(Hash key)

  whether or not the key qualifies as part of this bucket

### add

    public int add(Hash key)

  Add the peer to the bucket

  Returns:
    number of keys in the bucket after the addition

### remove

    public boolean remove(Hash key)

  Remove the key from the bucket

  Returns:
    true if the key existed in the bucket before removing it, else false

### getEntries

    public java.util.Set getEntries()

  Retrieve all routing table entries stored in the bucket

  Returns:
    set of Hash structures

### getEntries

    public java.util.Set getEntries(java.util.Set toIgnoreHashes)

  Retrieve hashes stored in the bucket, excluding the ones specified

  Returns:
    set of Hash structures

### getEntries

    public void getEntries(SelectionCollector collector)

### setEntries

    public void setEntries(java.util.Set entries)

  Fill the bucket with entries

  Parameters:
    `entries` - set of Hash structures

### generateRandomKey

    public Hash generateRandomKey()

  Generate a random key that would go inside this bucket

### getLocal

    public Hash getLocal()