public void RemoveEntrancePoint(int abstractId) { for (int i = 0; i < EntrancePoints.Count; i++) { if (EntrancePoints[i].AbstractId == abstractId) { EntrancePoints.RemoveAt(i); break; } } List <Tuple <int, int> > removeList = new List <Tuple <int, int> >(); foreach (var key in m_distanceDict.Keys) { if (key.Item1 == abstractId || key.Item2 == abstractId) { removeList.Add(key); } } for (int i = 0; i < removeList.Count; i++) { var key = removeList[i]; m_distanceDict.Remove(key); m_pathDict.Remove(key); } }
public void RemoveLastEntranceRecord() { var entrancePoint = EntrancePoints[EntrancePoints.Count - 1]; var abstractNodeToRemove = entrancePoint.AbstractNodeId; EntrancePoints.RemoveAt(EntrancePoints.Count - 1); var keysToRemove = new List <Tuple <Id <AbstractNode>, Id <AbstractNode> > >(); foreach (var key in _distanceCalculated.Keys) { if (key.Item1 == abstractNodeToRemove || key.Item2 == abstractNodeToRemove) { keysToRemove.Add(key); } } foreach (var key in keysToRemove) { _distanceCalculated.Remove(key); _distances.Remove(key); _cachedPaths.Remove(key); } }