boolean isViolating(RegionPlan regionPlan) {
    if (regionPlan == null) {
      return false;
    }
    int destinationServerIdx = cluster.serversToIndex.get(regionPlan.getDestination().getAddress());

    // Check Server
    int[] destinationRegionIndices = cluster.regionsPerServer[destinationServerIdx];
    Set<RegionInfo> serverRegions =
      getRegionsFromIndex(destinationServerIdx, cluster.regionsPerServer);
    for (int regionIdx : destinationRegionIndices) {
      serverRegions.add(cluster.regions[regionIdx]);
    }
    if (isViolatingServer(regionPlan, serverRegions)) {
      return true;
    }

    if (getValidationLevel() == ValidationLevel.SERVER) {
      return false;
    }

    // Check Host
    int hostIdx = cluster.serverIndexToHostIndex[destinationServerIdx];
    Set<RegionInfo> hostRegions = getRegionsFromIndex(hostIdx, cluster.regionsPerHost);
    if (isViolatingHost(regionPlan, hostRegions)) {
      return true;
    }

    if (getValidationLevel() == ValidationLevel.SERVER_HOST) {
      return false;
    }

    // Check Rack
    int rackIdx = cluster.serverIndexToRackIndex[destinationServerIdx];
    Set<RegionInfo> rackRegions = getRegionsFromIndex(rackIdx, cluster.regionsPerRack);
    if (isViolatingRack(regionPlan, rackRegions)) {
      return true;
    }

    return false;
  }
Check if the conditional is violated by the given region plan.
@param regionPlan the region plan to check
@return true if the conditional is violated
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionPlanConditional.java