@Override
  public Map<String, Set<String>> calculateHostGroups(Map<String, Set<String>> hostComponentMap) {
    HostGroupStrategy strategy =
      hostComponentMap.size() <= largeClusterThreshold ? new HostGroupForEachHostStrategy() : new GroupByComponentsStrategy();
    return strategy.calculateHostGroups(hostComponentMap);
  }
A strategy that chooses another strategy based on cluster size.
ambari-server/src/main/java/org/apache/ambari/server/topology/addservice/AutoHostgroupStrategy.java