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() {
40 public int getOpenRegions() {
44 public int getSplitRegions() {
48 public int getRegionsInTransition() {
49 return regionsInTransition
;
52 public int getTotalRegions() {
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
;
88 public RegionStatesCountBuilder
setSplitRegions(int splitRegions
) {
89 this.splitRegions
= splitRegions
;
93 public RegionStatesCountBuilder
setClosedRegions(int closedRegions
) {
94 this.closedRegions
= closedRegions
;
98 public RegionStatesCountBuilder
setRegionsInTransition(int regionsInTransition
) {
99 this.regionsInTransition
= regionsInTransition
;
103 public RegionStatesCountBuilder
setTotalRegions(int totalRegions
) {
104 this.totalRegions
= totalRegions
;
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
;
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
);
128 return sb
.toString();
132 public boolean equals(Object o
) {
136 if (o
== null || getClass() != o
.getClass()) {
140 RegionStatesCount that
= (RegionStatesCount
) o
;
142 if (openRegions
!= that
.openRegions
) {
145 if (splitRegions
!= that
.splitRegions
) {
148 if (closedRegions
!= that
.closedRegions
) {
151 if (regionsInTransition
!= that
.regionsInTransition
) {
154 return totalRegions
== that
.totalRegions
;
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
;