-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDnsNode.java
More file actions
136 lines (115 loc) · 3.21 KB
/
DnsNode.java
File metadata and controls
136 lines (115 loc) · 3.21 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//DO_NOT_EDIT_ANYTHING_ABOVE_THIS_LINE
package question;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
/**
* Represents a dns node.
* @author leylayayladere
* @version 1.0
*/
public class DnsNode {
/**
* In order to maintaining the tree structure.
*/
private Map<String, DnsNode> childNodeList = new TreeMap<String, DnsNode>();
/**
* Shows whether the current <code>DnsNode</code> has a valid IP address or not.
*/
private boolean validDomain;
/**
* The set is for storing IP addresses of this <code>DnsNode</code>.
*/
private Set<String> ipAddresses = new TreeSet<String>();
/**
* In order to follow the Round Robin mechanism while querying a domain name within the DNS.
*/
private Queue<String> ipRoundRobin = new LinkedList<String>();
/**
* The full domain name of this <code>DnsNode</code>.
*/
private String domainName;
/**
* Creates a <code>DnsNode</code> with an empty <code>childNodeList</code> and <code>ipAddresses</code>.
*/
public DnsNode() {
this.getChildNodeList().clear();
this.getIpAddresses().clear();;
this.getIpRoundRobin().clear();
this.setValidDomain(false);
}
/**
* Retrieves the values and keys of a <code>childNodeList</code> <i>map<i>.
* @return A collection data type.
*/
public Map<String, DnsNode> getChildNodeList() {
return childNodeList;
}
/**
* Sets the values and keys of a <code>childNodeList</code> <i>map<i>.
* @param childNodeList A variable of type collection.
*/
public void setChildNodeList(Map<String, DnsNode> childNodeList) {
this.childNodeList = childNodeList;
}
/**
* Retrieves whether this <code>DnsNode</code> is valid or not.
* @return A boolean data type.
*/
public boolean isValidDomain() {
return validDomain;
}
/**
* Sets whether this <code>DnsNode</code> is valid or not.
* @param validDomain A variable of type boolean.
*/
public void setValidDomain(boolean validDomain) {
this.validDomain = validDomain;
}
/**
* Retrieves the values of a <code>ipAddresses</code> <i>set<i>.
* @return A collection data type.
*/
public Set<String> getIpAddresses() {
return ipAddresses;
}
/**
* Sets the values of a <code>ipAddresses</code> <i>set<i>.
* @param ipAddresses A variable of type collection.
*/
public void setIpAddresses(Set<String> ipAddresses) {
this.ipAddresses = ipAddresses;
}
/**
* Retrieves the values of a <code>ipRoundRobin</code> <i>queue<i>.
* @return A queue data type.
*/
public Queue<String> getIpRoundRobin() {
return ipRoundRobin;
}
/**
* Sets the values of a <code>ipRoundRobin</code> <i>queue<i>.
* @param ipRoundRobin A variable of type queue.
*/
public void setIpRoundRobin(Queue<String> ipRoundRobin) {
this.ipRoundRobin = ipRoundRobin;
}
/**
* Retrieves the full domain name of this <code>DnsNode</code> .
* @return A String type.
*/
public String getDomainName() {
return domainName;
}
/**
* Sets the full domain name of a <code>DnsNode</code>.
* @param domainName A variable of type String.
*/
public void setDomainName(String domainName) {
this.domainName = domainName;
}
}
//DO_NOT_EDIT_ANYTHING_BELOW_THIS_LINE