1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.tikv.common.statistics;
19
20 import org.tikv.common.key.Key;
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 public class Bucket implements Comparable<Bucket> {
39 public long count;
40 private long repeats;
41 private Key lowerBound;
42 private Key upperBound;
43
44 public Bucket(long count, long repeats, Key lowerBound, Key upperBound) {
45 this.count = count;
46 this.repeats = repeats;
47 this.lowerBound = lowerBound;
48 this.upperBound = upperBound;
49 assert upperBound != null;
50 }
51
52
53 public Bucket(Key upperBound) {
54 this.upperBound = upperBound;
55 assert upperBound != null;
56 }
57
58 @Override
59 public int compareTo(Bucket b) {
60 return upperBound.compareTo(b.upperBound);
61 }
62
63 public long getCount() {
64 return count;
65 }
66
67 public void setCount(long count) {
68 this.count = count;
69 }
70
71 public long getRepeats() {
72 return repeats;
73 }
74
75 public void setRepeats(long repeats) {
76 this.repeats = repeats;
77 }
78
79 public Key getLowerBound() {
80 return lowerBound;
81 }
82
83 public void setLowerBound(Key lowerBound) {
84 this.lowerBound = lowerBound;
85 }
86
87 public Key getUpperBound() {
88 return upperBound;
89 }
90
91 public void setUpperBound(Key upperBound) {
92 this.upperBound = upperBound;
93 }
94
95 @Override
96 public String toString() {
97 return "{count="
98 + count
99 + ", repeats="
100 + repeats
101 + ", range=["
102 + lowerBound
103 + ", "
104 + upperBound
105 + "]}";
106 }
107 }