@Override
  protected void regionMoved(int region, int oldServer, int newServer) {
    int oldEntity =
      type == LocalityType.SERVER ? oldServer : cluster.serverIndexToRackIndex[oldServer];
    int newEntity =
      type == LocalityType.SERVER ? newServer : cluster.serverIndexToRackIndex[newServer];
    double localityDelta =
      getWeightedLocality(region, newEntity) - getWeightedLocality(region, oldEntity);
    double normalizedDelta = bestLocality == 0 ? 0.0 : localityDelta / bestLocality;
    locality += normalizedDelta;
  }
Maps region to the current entity (server or rack) on which it is stored
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/LocalityBasedCostFunction.java