-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNeighbour.java
More file actions
54 lines (42 loc) · 1.11 KB
/
Neighbour.java
File metadata and controls
54 lines (42 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package tw.nccu.edu.dht;
import java.io.Serializable;
import java.util.HashMap;
public class Neighbour implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String ip;
private int port;
private Coordinate c;
private HashMap<String, String> table = new HashMap<String, String>();
public Neighbour(String ip, int port, Coordinate c, HashMap<String, String> table) {
this.ip = ip;
this.port = port;
this.c = c;
this.table = table;
this.id = Integer.toString(port);
}
public String getId() {
return id;
}
public String getIp() {
return ip;
}
public int getServerPort() {
return port;
}
public Coordinate getCoordinate() {
return c;
}
public HashMap<String, String> getTable() {
return table;
}
public void setTable(HashMap<String, String> table) {
this.table = table;
}
public void showTable() {
System.out.println("Port " + getServerPort() + " files:");
for (String key : table.keySet()) {
System.out.println("Key: " + key.toString() + "\tValue: "+ table.get(key));
}
}
}