public void Add(WorkItem wi, int priority) { Contract.Requires(wi != null); string/*!*/ lab = wi.getLabel(); Contract.Assert(lab != null); if (labels.Contains(lab)) { // Already on worklist return; } labels.Add(lab); if (!workList.ContainsKey(priority)) { workList.Add(priority, new List<WorkItem/*!*/>()); } workList[priority].Add(wi); if (!priorities.ContainsKey(priority)) { priorities.Add(priority, 0); } priorities[priority] = priorities[priority] + 1; }