hasim-0.1: Process-Based Discrete Event Simulation librarySource codeContentsIndex
Abstract data type
Querying events
Discrete Event Set
ADT for Discrete Event Set
Creating Discrete Event Set
Querying Discrete Event Set
Updating Discrete Event Set

This module defines a DES, which stands for Discrete Event Set. There are functions for creating and inserting events.

For each process, an Event may be scheduled. This event consists of a Time and a Runnable. There can be at most one Event scheduled for each Process.

data Event
eTime :: Event -> Time
eRunnable :: Event -> Runnable
eProcess :: Event -> Process
data DES
initDES :: [Process] -> IO DES
emptyDES :: DES
isEmpty :: DES -> Bool
removeNext :: DES -> (Event, DES)
update :: Time -> Runnable -> DES -> DES
Abstract data type
data Event Source
Event. An event consists of a Time and a Runnable
show/hide Instances
Querying events
eTime :: Event -> TimeSource
The Time at which the event takes place.
eRunnable :: Event -> RunnableSource
The Runnable that should be run at this time
eProcess :: Event -> ProcessSource
The process of an Event
Discrete Event Set
ADT for Discrete Event Set
data DES Source
Discrete Event Set. A discrete event set is a data structure that supports the operations update and removeNext.
show/hide Instances
Creating Discrete Event Set
:: [Process]The list of processes
-> IO DESIO, with result the created DES
Create a new DES. For each Process, an Event is scheduled at time 0 and with Runnable the associated Runnable of the Process.
emptyDES :: DESSource
An empty discrete event set.
Querying Discrete Event Set
isEmpty :: DES -> BoolSource
Is the Discrete Event Set empty?
Updating Discrete Event Set
removeNext :: DES -> (Event, DES)Source

Get an event with lowest time that will take place next. Returns a tuple (evt, des) where evt is the next Event and des is the new DES where this event is removed.

Calls error if the DES is empty.

:: TimeThe time at which the event takes place
-> RunnableThe Runnable that should be run at that time
-> DESThe old discrete event set
-> DESThe discrete event set with the event added
Schedule an event in a discrete event set. Note that an old event of the same process is removed from the discrete event set.
Produced by Haddock version 2.3.0