1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.vcloud.domain;
20
21
22
23
24
25
26 public class Capacity {
27
28 private final String units;
29 private final long allocated;
30 private final long limit;
31 private final int used;
32 private final long overhead;
33
34 public Capacity(String units, long allocated, long limit, int used, long overhead) {
35 this.units = units;
36 this.limit = limit;
37 this.allocated = allocated;
38 this.used = used;
39 this.overhead = overhead;
40 }
41
42 public String getUnits() {
43 return units;
44 }
45
46 public long getAllocated() {
47 return allocated;
48 }
49
50 public long getLimit() {
51 return limit;
52 }
53
54
55
56
57 public int getUsed() {
58 return used;
59 }
60
61
62
63
64 public long getOverhead() {
65 return overhead;
66 }
67
68 @Override
69 public int hashCode() {
70 final int prime = 31;
71 int result = 1;
72 result = prime * result + (int) (allocated ^ (allocated >>> 32));
73 result = prime * result + (int) (limit ^ (limit >>> 32));
74 result = prime * result + (int) (overhead ^ (overhead >>> 32));
75 result = prime * result + ((units == null) ? 0 : units.hashCode());
76 result = prime * result + used;
77 return result;
78 }
79
80 @Override
81 public boolean equals(Object obj) {
82 if (this == obj)
83 return true;
84 if (obj == null)
85 return false;
86 if (getClass() != obj.getClass())
87 return false;
88 Capacity other = (Capacity) obj;
89 if (allocated != other.allocated)
90 return false;
91 if (limit != other.limit)
92 return false;
93 if (overhead != other.overhead)
94 return false;
95 if (units == null) {
96 if (other.units != null)
97 return false;
98 } else if (!units.equals(other.units))
99 return false;
100 if (used != other.used)
101 return false;
102 return true;
103 }
104
105 @Override
106 public String toString() {
107 return "[allocated=" + allocated + ", limit=" + limit + ", overhead=" + overhead + ", units=" + units + ", used="
108 + used + "]";
109 }
110 }