mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-22 02:02:21 +00:00
Renamed the KadBucket to KademliaBucket
Renamed KadBucketImpl to JKademliaBucket because it's an implementation of KademliaBucket
This commit is contained in:
parent
41df450f4a
commit
d6ab1493b8
@ -13,7 +13,7 @@ import kademlia.node.Node;
|
|||||||
* @author Joshua Kissoon
|
* @author Joshua Kissoon
|
||||||
* @created 20140215
|
* @created 20140215
|
||||||
*/
|
*/
|
||||||
public class KadBucketImpl implements KadBucket
|
public class JKademliaBucket implements KademliaBucket
|
||||||
{
|
{
|
||||||
|
|
||||||
/* How deep is this bucket in the Routing Table */
|
/* How deep is this bucket in the Routing Table */
|
||||||
@ -37,7 +37,7 @@ public class KadBucketImpl implements KadBucket
|
|||||||
* @param depth How deep in the routing tree is this bucket
|
* @param depth How deep in the routing tree is this bucket
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
public KadBucketImpl(int depth, KadConfiguration config)
|
public JKademliaBucket(int depth, KadConfiguration config)
|
||||||
{
|
{
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
this.config = config;
|
this.config = config;
|
@ -18,7 +18,7 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
{
|
{
|
||||||
|
|
||||||
private final Node localNode; // The current node
|
private final Node localNode; // The current node
|
||||||
private transient KadBucket[] buckets;
|
private transient KademliaBucket[] buckets;
|
||||||
|
|
||||||
private transient KadConfiguration config;
|
private transient KadConfiguration config;
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
@Override
|
@Override
|
||||||
public final void initialize()
|
public final void initialize()
|
||||||
{
|
{
|
||||||
this.buckets = new KadBucket[KademliaId.ID_LENGTH];
|
this.buckets = new KademliaBucket[KademliaId.ID_LENGTH];
|
||||||
for (int i = 0; i < KademliaId.ID_LENGTH; i++)
|
for (int i = 0; i < KademliaId.ID_LENGTH; i++)
|
||||||
{
|
{
|
||||||
buckets[i] = new KadBucketImpl(i, this.config);
|
buckets[i] = new JKademliaBucket(i, this.config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
{
|
{
|
||||||
List<Node> nodes = new ArrayList<>();
|
List<Node> nodes = new ArrayList<>();
|
||||||
|
|
||||||
for (KadBucket b : this.buckets)
|
for (KademliaBucket b : this.buckets)
|
||||||
{
|
{
|
||||||
for (Contact c : b.getContacts())
|
for (Contact c : b.getContacts())
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
{
|
{
|
||||||
List<Contact> contacts = new ArrayList<>();
|
List<Contact> contacts = new ArrayList<>();
|
||||||
|
|
||||||
for (KadBucket b : this.buckets)
|
for (KademliaBucket b : this.buckets)
|
||||||
{
|
{
|
||||||
contacts.addAll(b.getContacts());
|
contacts.addAll(b.getContacts());
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
* @return Bucket[] The buckets in this Kad Instance
|
* @return Bucket[] The buckets in this Kad Instance
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final KadBucket[] getBuckets()
|
public final KademliaBucket[] getBuckets()
|
||||||
{
|
{
|
||||||
return this.buckets;
|
return this.buckets;
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
*
|
*
|
||||||
* @param buckets
|
* @param buckets
|
||||||
*/
|
*/
|
||||||
public final void setBuckets(KadBucket[] buckets)
|
public final void setBuckets(KademliaBucket[] buckets)
|
||||||
{
|
{
|
||||||
this.buckets = buckets;
|
this.buckets = buckets;
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ public class JKademliaRoutingTable implements KademliaRoutingTable
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder("\nPrinting Routing Table Started ***************** \n");
|
StringBuilder sb = new StringBuilder("\nPrinting Routing Table Started ***************** \n");
|
||||||
int totalContacts = 0;
|
int totalContacts = 0;
|
||||||
for (KadBucket b : this.buckets)
|
for (KademliaBucket b : this.buckets)
|
||||||
{
|
{
|
||||||
if (b.numContacts() > 0)
|
if (b.numContacts() > 0)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ import kademlia.node.Node;
|
|||||||
* @author Joshua Kissoon
|
* @author Joshua Kissoon
|
||||||
* @created 20140215
|
* @created 20140215
|
||||||
*/
|
*/
|
||||||
public interface KadBucket
|
public interface KademliaBucket
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
@ -72,7 +72,7 @@ public interface KademliaRoutingTable
|
|||||||
/**
|
/**
|
||||||
* @return Bucket[] The buckets in this Kad Instance
|
* @return Bucket[] The buckets in this Kad Instance
|
||||||
*/
|
*/
|
||||||
public KadBucket[] getBuckets();
|
public KademliaBucket[] getBuckets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used by operations to notify the routing table of any contacts that have been unresponsive.
|
* Method used by operations to notify the routing table of any contacts that have been unresponsive.
|
||||||
|
Loading…
Reference in New Issue
Block a user