// Adds to the list of tracks that has separation conditions private void AddToTrackList(Track t1, Track t2) { var tempocc = new Occurence(); tempocc.Tag1 = t1.Tag; tempocc.Tag2 = t2.Tag; _listOfConditionTracks.Add(tempocc); }
// Removes two tracks from the list of conditions, if they're no longer in danger private void RemoveIfNoLongerCondition(Track track1, Track track2) { if ((track1.Altitude - track2.Altitude) <= 300 && (DistanceCalculator(track1, track2) <= 5000)) { return; } else { var removeHelper = new Occurence(); removeHelper.Tag1 = track1.Tag; removeHelper.Tag2 = track2.Tag; _listOfConditionTracks.Remove(removeHelper); } }
// Checks if two tracks are in the list of separation conditions in both ways private bool CheckIfInList(Track a, Track b) { var tempocc = new Occurence(); tempocc.Tag1 = a.Tag; tempocc.Tag2 = b.Tag; bool doesItExist = false; foreach (var occ in _listOfConditionTracks) { if (occ.Tag1 == a.Tag && occ.Tag2 == b.Tag) { doesItExist = true; } if (occ.Tag2 == a.Tag && occ.Tag1 == b.Tag) { doesItExist = true; } } return(doesItExist); }