private Set<StoragePort> filterCandidates(Set<StoragePort> candidates,Set<String> allocatedEntitySet,Map<String,Set<StoragePort>> contextEntityMap){
  if (false == contextEntityMap.isEmpty()) {
    Map<String,Set<StoragePort>> newEntityMap=removeStoragePortSets(allocatedEntitySet,contextEntityMap);
    if (newEntityMap.isEmpty() == false) {
      Set<StoragePort> newEngineSet=andStoragePortSets(candidates,reduceStoragePortMap(newEntityMap));
      if (newEngineSet.isEmpty() == false) {
        candidates=newEngineSet;
      }
    }
 else {
      _log.debug("Used all entities: " + allocatedEntitySet.toString());
      allocatedEntitySet.clear();
    }
  }
  return candidates;
}

private Set < StoragePort > filterCandidates ( Set < StoragePort > candidates , Set < String > allocatedEntitySet , Map < String , Set < StoragePort > > contextEntityMap ) { if ( false == contextEntityMap . isEmpty ( ) ) { Map < String , Set < StoragePort > > newEntityMap = removeStoragePortSets ( allocatedEntitySet , contextEntityMap ) ; if ( newEntityMap . isEmpty ( ) == false ) { Set < StoragePort > newEngineSet = andStoragePortSets ( candidates , reduceStoragePortMap ( newEntityMap ) ) ; if ( newEngineSet . isEmpty ( ) == false ) { candidates = newEngineSet ; } } else { _log . debug ( "Used all entities: " + allocatedEntitySet . toString ( ) ) ; allocatedEntitySet . clear ( ) ; } } return candidates ; }
filter the set of candidates based on already used entities of some type . the currently entity types are engines , directors , director types , cpus , and sanswitches . the filter is only applied if the resultant set is not empty ( meaning there are still remaining ports to be selected after the filter is supplied ) . once a port has been selected that represents each of the available entities , the allocatedentityset is cleared , which results in cycling through the entities again .
