MCPcopy Create free account
hub / github.com/InterviewReady/Low-Level-Design / Node

Class Node

service-orchestrator/src/main/java/models/Node.java:5–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import java.util.Objects;
4
5public class Node {
6 private final String id;
7 private final int weight;
8 private final String ipAddress;
9
10 public Node(String id, String ipAddress) {
11 this(id, ipAddress, 1);
12 }
13
14 public Node(String id, String ipAddress, int weight) {
15 this.id = id;
16 this.weight = weight;
17 this.ipAddress = ipAddress;
18 }
19
20 public String getId() {
21 return id;
22 }
23
24 public int getWeight() {
25 return weight;
26 }
27
28 public String getIpAddress() {
29 return ipAddress;
30 }
31
32 @Override
33 public boolean equals(Object o) {
34 if (this == o) return true;
35 if (o == null || getClass() != o.getClass()) return false;
36 Node node = (Node) o;
37 return id.equals(node.id);
38 }
39
40 @Override
41 public int hashCode() {
42 return Objects.hash(id);
43 }
44
45}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected