public Rid Submit(Ip ip, int time) { int jobCount = userJobs.ContainsCount(ip); Rid rid = new Rid(); Job job = new Job(rid, ip, time + 60 * jobCount); IPriorityQueueHandle <Job> h = null; jobQueue.Add(ref h, job); userJobs.Add(ip); jobs.Add(rid, h); Console.WriteLine("Submitted {0}", job); return(rid); }
public Rid Submit(Ip ip, int time) { var jobCount = _userJobs.ContainsCount(ip); var rid = new Rid(); var job = new Job(rid, ip, time + 60 * jobCount); IPriorityQueueHandle <Job> h = default; _jobQueue.Add(ref h, job); _userJobs.Add(ip); _jobs.Add(rid, h); Console.WriteLine($"Submitted {job}"); return(rid); }
public void CountEtAl() { Assert.IsFalse(hashbag.IsReadOnly); // Assert.IsFalse(hashbag.SyncRoot == null); Assert.AreEqual(0, hashbag.Count); Assert.IsTrue(hashbag.IsEmpty); Assert.IsTrue(hashbag.AllowsDuplicates); Assert.IsTrue(hashbag.Add(0)); Assert.AreEqual(1, hashbag.Count); Assert.IsFalse(hashbag.IsEmpty); Assert.IsTrue(hashbag.Add(5)); Assert.AreEqual(2, hashbag.Count); Assert.IsTrue(hashbag.Add(5)); Assert.AreEqual(3, hashbag.Count); Assert.IsFalse(hashbag.IsEmpty); Assert.IsTrue(hashbag.Add(8)); Assert.AreEqual(4, hashbag.Count); Assert.AreEqual(2, hashbag.ContainsCount(5)); Assert.AreEqual(1, hashbag.ContainsCount(8)); Assert.AreEqual(1, hashbag.ContainsCount(0)); }