public bool PushEvent(TTimeAbs occurredTime, TDiscreteEvent.DiscreteEventAction action, object param = null, int priority = (int)EDiscreteEventPriority.Default) { LinkedListNode <TDiscreteEvent> result = _events.Last; while (result != null) { if (occurredTime > result.Value.TriggeredTime || (occurredTime == result.Value.TriggeredTime && priority < result.Value.Priority)) { break; } result = result.Previous; } TDiscreteEvent newEvt = new TDiscreteEvent(); newEvt.TriggeredTime = occurredTime; newEvt.EventAction = action; newEvt.Priority = priority; newEvt.Param = param; if (result == null) { _events.AddFirst(newEvt); } else { _events.AddAfter(result, newEvt); } return(true); }
public bool PushEvent(TTimeAbs currentTime, TTimeRel timeAfter, TDiscreteEvent.DiscreteEventAction action, object param = null, int priority = (int)EDiscreteEventPriority.Default) { TTimeAbs occurredTime = currentTime + timeAfter; return(PushEvent(occurredTime, action, param, priority)); }