Beispiel #1
0
 private HashSet <IStorageNetworkNode> GetDemandNodes(VehicleStation station, bool additionalDemands = true)
 {
     if (!_demandNodesCache.TryGetValue((station, additionalDemands), out HashSet <IStorageNetworkNode> result))
     {
         result = new HashSet <IStorageNetworkNode>(DemandHelper.GetStationDemandNodes(station, additionalDemands));
         foreach (VehicleStation addStation in GetConnectedStationsEnum(station))
         {
             result.UnionWith(DemandHelper.GetStationDemandNodes(addStation, false, false));
         }
         _demandNodesCache.Add((station, additionalDemands), result);
     }
     return(result);
 }
Beispiel #2
0
 public bool AddConnectedStation(VehicleStation station, VehicleStation stationToAdd)
 {
     if (stationToAdd != station)
     {
         _connectedBuildings.Add(stationToAdd);
         bool result = GetOrCreateConnectedStationsList(station).Add(stationToAdd);
         if (result)
         {
             if (_additionalDemands.TryGetValue(station, out UniqueList <IStorageNetworkNode> additionalDemands))
             {
                 //remove demands of added station from additional demands of own station
                 foreach (IStorageNetworkNode node in DemandHelper.GetStationDemandNodes(stationToAdd, false))
                 {
                     additionalDemands.QuickRemove(node);
                 }
             }
             OnConnectedStationChange(station);
         }
         return(result);
     }
     return(false);
 }