@Override
  protected void regionMoved(int region, int oldServer, int newServer) {
    // recompute the stat for the given two region servers
    cost.applyCostsChange(costs -> {
      costs[oldServer] = computeCostForRegionServer(oldServer);
      costs[newServer] = computeCostForRegionServer(newServer);
    });
  }
Base class the allows writing costs functions from rolling average of some number from
RegionLoad.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFromRegionLoadFunction.java