Documentation
¶
Index ¶
- type Event
- type EventQueue
- func (eq *EventQueue) Add(event *Event)
- func (eq EventQueue) Len() int
- func (eq EventQueue) Less(i, j int) bool
- func (eq *EventQueue) Next() *Event
- func (eq EventQueue) NextT() (t float64, ok bool)
- func (eq *EventQueue) Pop() interface{}
- func (eq *EventQueue) Push(x interface{})
- func (eq EventQueue) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { T float64 F func() }
Event represents a single Event in the simulation
type EventQueue ¶
type EventQueue []*Event
EventQueue implements a priority queue for Events.
func (EventQueue) Less ¶
func (eq EventQueue) Less(i, j int) bool
Less returns true if the event at index i is less/earlier than the event at index j.
func (*EventQueue) Next ¶
func (eq *EventQueue) Next() *Event
Next retrieves and removes the Next event from the queue.
func (EventQueue) NextT ¶
func (eq EventQueue) NextT() (t float64, ok bool)
tNext returns the time of the next event in ms. If there are no more events then ok is false.
func (*EventQueue) Pop ¶
func (eq *EventQueue) Pop() interface{}
Pop removes and returns the last event from the event queue. Only to be used by the heap package. Never call it directly.
func (*EventQueue) Push ¶
func (eq *EventQueue) Push(x interface{})
Push adds an event to the event queue. Only to be used by the heap package. Never call it directly.
func (EventQueue) Swap ¶
func (eq EventQueue) Swap(i, j int)
Swap swaps the events at index i and j. Only to be used by the heap package. Never call it directly.