-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathNodeOfMac.java
More file actions
68 lines (60 loc) · 1.26 KB
/
NodeOfMac.java
File metadata and controls
68 lines (60 loc) · 1.26 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
57
58
59
60
61
62
63
64
65
66
67
68
public class NodeOfMac implements Comparable<NodeOfMac> {
//MAC地址
private long value;
//计数器
private int counter;
public NodeOfMac() {
this.value = 0;
this.counter = 0;
}
public NodeOfMac(long value,int counter) {
this.value = value;
this.counter = counter;
}
/**
* 设置节点的MAC地址
*
* @param value Long Integer
*/
public void setValue(long value) {
this.value = value;
}
/**
* 设置MAC地址的计数器
*
* @param counter Integer
*/
public void setCounter(int counter) {
this.counter = counter;
}
/**
* 返回节点的MAC地址
*
* @return
*/
public long getValue() {
return this.value;
}
/**
* 返回节点对应的计数器
*
* @return
*/
public String getCounter() {
return String.valueOf(counter);
}
@Override
public int compareTo(NodeOfMac o) {
if (this.getValue() > o.getValue()) {
return 1;
} else if (this.getValue() < o.getValue()) {
return -1;
}
else
return 0;
}
@Override
public String toString () {
return this.getCounter();
}
}