HBASE-25617 Revisit the span names (#2998)
[hbase.git] / hbase-client / src / main / java / org / apache / hadoop / hbase / client / RegionStatesCount.java
blob1e1ce95113b96bbd17198943fc6a345c27aad503
1 /*
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 package org.apache.hadoop.hbase.client;
22 import org.apache.yetus.audience.InterfaceAudience;
24 @InterfaceAudience.Private
25 public final class RegionStatesCount {
27 private int openRegions;
28 private int splitRegions;
29 private int closedRegions;
30 private int regionsInTransition;
31 private int totalRegions;
33 private RegionStatesCount() {
36 public int getClosedRegions() {
37 return closedRegions;
40 public int getOpenRegions() {
41 return openRegions;
44 public int getSplitRegions() {
45 return splitRegions;
48 public int getRegionsInTransition() {
49 return regionsInTransition;
52 public int getTotalRegions() {
53 return totalRegions;
56 private void setClosedRegions(int closedRegions) {
57 this.closedRegions = closedRegions;
60 private void setOpenRegions(int openRegions) {
61 this.openRegions = openRegions;
64 private void setSplitRegions(int splitRegions) {
65 this.splitRegions = splitRegions;
68 private void setRegionsInTransition(int regionsInTransition) {
69 this.regionsInTransition = regionsInTransition;
72 private void setTotalRegions(int totalRegions) {
73 this.totalRegions = totalRegions;
76 public static class RegionStatesCountBuilder {
77 private int openRegions;
78 private int splitRegions;
79 private int closedRegions;
80 private int regionsInTransition;
81 private int totalRegions;
83 public RegionStatesCountBuilder setOpenRegions(int openRegions) {
84 this.openRegions = openRegions;
85 return this;
88 public RegionStatesCountBuilder setSplitRegions(int splitRegions) {
89 this.splitRegions = splitRegions;
90 return this;
93 public RegionStatesCountBuilder setClosedRegions(int closedRegions) {
94 this.closedRegions = closedRegions;
95 return this;
98 public RegionStatesCountBuilder setRegionsInTransition(int regionsInTransition) {
99 this.regionsInTransition = regionsInTransition;
100 return this;
103 public RegionStatesCountBuilder setTotalRegions(int totalRegions) {
104 this.totalRegions = totalRegions;
105 return this;
108 public RegionStatesCount build() {
109 RegionStatesCount regionStatesCount=new RegionStatesCount();
110 regionStatesCount.setOpenRegions(openRegions);
111 regionStatesCount.setClosedRegions(closedRegions);
112 regionStatesCount.setRegionsInTransition(regionsInTransition);
113 regionStatesCount.setSplitRegions(splitRegions);
114 regionStatesCount.setTotalRegions(totalRegions);
115 return regionStatesCount;
119 @Override
120 public String toString() {
121 final StringBuilder sb = new StringBuilder("RegionStatesCount{");
122 sb.append("openRegions=").append(openRegions);
123 sb.append(", splitRegions=").append(splitRegions);
124 sb.append(", closedRegions=").append(closedRegions);
125 sb.append(", regionsInTransition=").append(regionsInTransition);
126 sb.append(", totalRegions=").append(totalRegions);
127 sb.append('}');
128 return sb.toString();
131 @Override
132 public boolean equals(Object o) {
133 if (this == o) {
134 return true;
136 if (o == null || getClass() != o.getClass()) {
137 return false;
140 RegionStatesCount that = (RegionStatesCount) o;
142 if (openRegions != that.openRegions) {
143 return false;
145 if (splitRegions != that.splitRegions) {
146 return false;
148 if (closedRegions != that.closedRegions) {
149 return false;
151 if (regionsInTransition != that.regionsInTransition) {
152 return false;
154 return totalRegions == that.totalRegions;
157 @Override
158 public int hashCode() {
159 int result = openRegions;
160 result = 31 * result + splitRegions;
161 result = 31 * result + closedRegions;
162 result = 31 * result + regionsInTransition;
163 result = 31 * result + totalRegions;
164 return result;