-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
56 lines (49 loc) · 1.11 KB
/
Node.java
File metadata and controls
56 lines (49 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
55
56
/**************************************************************************
* This class is the data structure that record a node's socket info
*
* Revise Time Description Author
* v1.0 2018/10/14 Initial YG
*
*************************************************************************/
public class Node {
private int id;
private String host_name;
private int port;
public Node() {
id = -1;
host_name = "";
port = -1;
}
public Node(int n, String host, int p) {
id = n;
host_name = host;
port = p;
}
public void set_node_info(int n, String host, int p) {
id = n;
host_name = host;
port = p;
}
public void set_id(int n) {
id = n;
}
public int get_id() {
return id;
}
public void set_host_name(String h) {
host_name = h;
}
public String get_host_name() {
return host_name;
}
public void set_port(int p) {
port = p;
}
public int get_port() {
return port;
}
@Override
public String toString() {
return String.format("[id=%d, host=%s, port=%d]", id, host_name, port);
}
}