private static long computeExpectedTimeBasedOnOtherTargets(BuildTargetType<?> type,
                                                             Set<? extends BuildTargetType<?>> allTypes,
                                                             Object2LongMap<BuildTargetType<?>> expectedBuildTimeForTarget) {
    BuilderRegistry registry = BuilderRegistry.getInstance();
    int baseTargetsCount = 0;
    long expectedTimeSum = 0;
    for (BuildTargetType<?> anotherType : allTypes) {
      long realExpectedTime = expectedBuildTimeForTarget.getLong(anotherType);
      long defaultExpectedTime = registry.getExpectedBuildTimeForTarget(anotherType);
      if (realExpectedTime != -1 && defaultExpectedTime > 0) {
        baseTargetsCount++;
        expectedTimeSum += realExpectedTime * registry.getExpectedBuildTimeForTarget(type) / defaultExpectedTime;
      }
    }
    return baseTargetsCount != 0 ? expectedTimeSum/baseTargetsCount : registry.getExpectedBuildTimeForTarget(type);
  }
private static long computeExpectedTimeBasedOnOtherTargets(BuildTargetType<?> type,
                                                             Set<? extends BuildTargetType<?>> allTypes,
                                                             Object2LongMap<BuildTargetType<?>> expectedBuildTimeForTarget)