Added ListenThread stub

This commit is contained in:
senft-desktop 2012-11-14 09:14:51 +01:00
parent dac5fe1615
commit a7043d1522
4 changed files with 22 additions and 9 deletions

View File

@ -25,16 +25,9 @@ public class Network {
Peer a = new Peer("A");
// System.out.println("Spawn B:");
a.spawn("B");
// System.out.println("Spawn C:");
a.spawn("C");
// System.out.println("Spawn D:");
a.spawn("D");
// System.out.println("Leave A:");
a.leave();
}

View File

@ -104,6 +104,14 @@ public class Node {
return this.name;
}
/**
* TODO: Wenn die richtig implementiert ist, ist die
* {@link #removeNeighbour(Node) removeNeighbour} ein Einzeiler.
*/
public boolean equals(Object o) {
return false;
}
public void printInfos() {
StringBuilder result = new StringBuilder(128);
result.append("Name: " + this.name + ", Neighbours: ");

View File

@ -22,7 +22,7 @@ public class Peer {
* Create another peer, mutually link creator and spawn.
*/
public void spawn(String name) {
LOGGER.info("Spawning " + name);
LOGGER.info("Name: " + node.getName() + ", Spawning " + name);
// create a new node
Node spawnNode = new Node(new Random().nextInt(), name);
@ -37,7 +37,7 @@ public class Peer {
* exit.
*/
public void leave() {
LOGGER.info("Leaving..." + node.getName());
LOGGER.info("Name: " + node.getName() + ", Leaving...");
List<Node> neighbours = this.node.getNeighbours();

View File

@ -0,0 +1,12 @@
package peer;
public class UDPListen extends Thread {
public UDPListen(int port) {
}
public void run() {
}
}