} //Push public void Update(BasePriorityKey currentPriority) { if (base.Count == 0) { return; } for (int index = 0; index < base.Keys.Count; index++) { if (base.Keys[index].IsExpired(currentPriority)) { base[base.Keys[index]].Run(); this.mToRemove.Add(base.Keys[index]); } else { break; //no reason to continue if the item is not expired yet. } } //next index if (this.mToRemove.Count > 0) { for (int index = (this.mToRemove.Count - 1); index >= 0; index--) { base.Remove(this.mToRemove[index]); } //next index } } //Update
public void Push(BasePriorityKey key, BaseEvent evnt) { base.Add(new PriorityKey(key), evnt); } //Push
public bool IsExpired(BasePriorityKey key) { return(key.CompareTo(this.Key) >= 0); }
public PriorityKey(BasePriorityKey key) { this.Key = key; }