1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.metrics2.util;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22
23
24
25
26
27 @InterfaceAudience.Private
28 public class MetricQuantile {
29 public final double quantile;
30 public final double error;
31
32 public MetricQuantile(double quantile, double error) {
33 this.quantile = quantile;
34 this.error = error;
35 }
36
37 @Override
38 public boolean equals(Object aThat) {
39 if (this == aThat) {
40 return true;
41 }
42 if (!(aThat instanceof MetricQuantile)) {
43 return false;
44 }
45
46 MetricQuantile that = (MetricQuantile) aThat;
47
48 long qbits = Double.doubleToLongBits(quantile);
49 long ebits = Double.doubleToLongBits(error);
50
51 return qbits == Double.doubleToLongBits(that.quantile)
52 && ebits == Double.doubleToLongBits(that.error);
53 }
54
55 @Override
56 public int hashCode() {
57 return (int) (Double.doubleToLongBits(quantile) ^ Double
58 .doubleToLongBits(error));
59 }
60 }