core

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2025 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

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 NewEventQueue

func NewEventQueue() *EventQueue

NewEventQueue creates a new EventQueue.

func (*EventQueue) Add

func (eq *EventQueue) Add(event *Event)

Add adds a new event to the queue.

func (EventQueue) Len

func (eq EventQueue) Len() int

Len returns the length of the event queue.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL