public bool RemoveNotice(Notice no) { if (!AvailableJobsContainsContentEqual(no)) return false; foreach (NabfProject.AI.NabfAgent a in no.GetAgentsApplied()) UnApplyToNotice(no, a); _idToNotice.Remove(no.Id); _availableJobs.Remove(NoticeToJobType(no), no); return true; }
public int FindTopDesiresForNotice(Notice n, out SortedList<int, NabfAgent> topDesires, out List<NabfAgent> agents) { int desire = 0, lowestDesire = -(n.GetAgentsApplied().Count + 1); agents = new List<NabfAgent>(); topDesires = new SortedList<int, NabfAgent>(new InvertedComparer<int>()); for (int i = 0; i < n.AgentsNeeded; i++) { topDesires.Add(lowestDesire--, null); } desire = 0; lowestDesire = -1; foreach (NabfAgent a in n.GetAgentsApplied()) { n.TryGetValueAgentToDesirabilityMap(a, out desire); if (desire > lowestDesire) { topDesires.Add(desire, a); agents.Add(a); agents.Remove(topDesires.Last().Value); topDesires.RemoveAt(n.AgentsNeeded); lowestDesire = topDesires.Keys[n.AgentsNeeded - 1]; } } return lowestDesire; }