/**
   * @Title: getNominalChosenSpotGroup @Description: get all instances can be potential capacity in
   * a spot group
   *
   * @param instanceTemplate the spot group
   * @return all instances can be potential capacity in a spot group
   * @throws
   */
  public synchronized Collection<InstanceStatus> getNominalChosenSpotGroup(
      InstanceTemplate instanceTemplate) {
    Set<InstanceStatus> group = spotGroups.get(instanceTemplate);
    if (group != null) {
      return InstanceFilter.getNominalInstances(snapshot(group));
    }

    return null;
  }
 /**
  * @Title: getNominalSpotGroups @Description: get all instances in spot groups that can be
  * potential capacity
  *
  * @return all instances in spot groups that can be potential capacity
  * @throws
  */
 public synchronized Map<InstanceTemplate, Collection<InstanceStatus>> getNominalSpotGroups() {
   Map<InstanceTemplate, Collection<InstanceStatus>> nominalSpotGroupsMap =
       new HashMap<InstanceTemplate, Collection<InstanceStatus>>();
   Map<InstanceTemplate, Set<InstanceStatus>> spotGroups = getSpotGroups();
   for (Entry<InstanceTemplate, Set<InstanceStatus>> entry : spotGroups.entrySet()) {
     nominalSpotGroupsMap.put(
         entry.getKey(), InstanceFilter.getNominalInstances(entry.getValue()));
   }
   return nominalSpotGroupsMap;
 }
  /**
   * @Title: getNominalCapacity @Description: get the number of capacity if all nominal instances
   * are online
   *
   * @return
   * @throws
   */
  public synchronized long getNominalCapacity() {
    FaultTolerantLevel ftLevel = FaultTolerantLevel.ZERO;
    if (isSpotEnabled()) {
      ftLevel = this.faultTolerantLevel;
    }

    long capacity = 0;
    Collection<InstanceStatus> nominalInstances = InstanceFilter.getNominalInstances(allInstances);

    for (InstanceStatus instanceStatus : nominalInstances) {
      InstanceTemplate instanceTemplate = instanceStatus.getType();
      capacity += instanceTemplate.getCapacity(ftLevel);
    }
    return capacity;
  }
 /**
  * @Title: getNominalOnDemandInstances @Description: get all on demand instances can be potential
  * capacity
  *
  * @return all on demand instances can be potential capacity
  * @throws
  */
 public synchronized Collection<InstanceStatus> getNominalOnDemandInstances() {
   return InstanceFilter.getNominalInstances(new ArrayList<InstanceStatus>(onDemandInstances));
 }