1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.vcloud.domain.network;
20
21 import static com.google.common.base.Preconditions.checkNotNull;
22
23
24
25
26
27 public class IpRange {
28 private final String startAddress;
29 private final String endAddress;
30
31 public IpRange(String startAddress, String endAddress) {
32 this.startAddress = checkNotNull(startAddress, "startAddress");
33 this.endAddress = checkNotNull(endAddress, "endAddress");
34 }
35
36
37
38
39
40
41 public String getStartAddress() {
42 return startAddress;
43 }
44
45
46
47
48
49
50 public String getEndAddress() {
51 return endAddress;
52 }
53
54 @Override
55 public int hashCode() {
56 final int prime = 31;
57 int result = 1;
58 result = prime * result + ((endAddress == null) ? 0 : endAddress.hashCode());
59 result = prime * result + ((startAddress == null) ? 0 : startAddress.hashCode());
60 return result;
61 }
62
63 @Override
64 public boolean equals(Object obj) {
65 if (this == obj)
66 return true;
67 if (obj == null)
68 return false;
69 if (getClass() != obj.getClass())
70 return false;
71 IpRange other = (IpRange) obj;
72 if (endAddress == null) {
73 if (other.endAddress != null)
74 return false;
75 } else if (!endAddress.equals(other.endAddress))
76 return false;
77 if (startAddress == null) {
78 if (other.startAddress != null)
79 return false;
80 } else if (!startAddress.equals(other.startAddress))
81 return false;
82 return true;
83 }
84
85 @Override
86 public String toString() {
87 return "[startAddress=" + startAddress + ", endAddress=" + endAddress + "]";
88 }
89 }