public IShortcutSet ExtractShortcuts(int level) { var set = ShortcutSetFactory.Create(Input.Trajectory); var epsilon = Input.GetEpsilon(level); var shortcutsToRemove = new HashSet <Shortcut>(); foreach (var pair in MaxErrors) { var maxError = pair.Value; if (epsilon <= maxError) { set.AppendShortcut(pair.Key.Start, pair.Key.End); if (Input.Cumulative) { shortcutsToRemove.Add(pair.Key); } } } foreach (var shortcut in shortcutsToRemove) { MaxErrors.Remove(shortcut); } return(set); }
public void Remove(Shortcut shortcut) { if (!MinLevels.ContainsKey(shortcut)) { return; } var minLevel = MinLevels[shortcut]; LevelCounts[minLevel]--; MinLevels.Remove(shortcut); }
public void UpdateValues(Database db) { Government government; Military military; if (db.Governments.TryGetValue(kSuperGovernment, out government)) { SuperGovernment = government; } if (db.Militaries.TryGetValue(kMilitary, out military)) { Military = military; } foreach (string k in Relationships.Keys) { if (!db.Governments.ContainsKey(k)) { Relationships.Remove(k); } } Relationships[ID] = Relationship.Ally; }