aivika-transformers-2.0: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.QueueStrategy

Description

Tested with: GHC 7.8.3

This module defines the queue strategies.

Synopsis

Documentation

class MonadComp m => QueueStrategy m s where Source

Defines the basic queue strategy.

Associated Types

data StrategyQueue m s :: * -> * Source

The strategy queue.

Methods

newStrategyQueue Source

Arguments

:: s

the strategy

-> Simulation m (StrategyQueue m s a)

a new queue

Create a new queue by the specified strategy.

strategyQueueNull Source

Arguments

:: StrategyQueue m s a

the queue

-> Event m Bool

the result of the test

Test whether the queue is empty.

Instances

MonadComp m => QueueStrategy m SIRO

An implementation of the SIRO queue strategy.

MonadComp m => QueueStrategy m StaticPriorities

An implementation of the StaticPriorities queue strategy.

MonadComp m => QueueStrategy m LCFS

An implementation of the LCFS queue strategy.

MonadComp m => QueueStrategy m FCFS

An implementation of the FCFS queue strategy.

class QueueStrategy m s => DequeueStrategy m s where Source

Defines a strategy with support of the dequeuing operation.

Methods

strategyDequeue Source

Arguments

:: StrategyQueue m s a

the queue

-> Event m a

the dequeued element

Dequeue the front element and return it.

Instances

QueueStrategy m SIRO => DequeueStrategy m SIRO

An implementation of the SIRO queue strategy.

QueueStrategy m StaticPriorities => DequeueStrategy m StaticPriorities

An implementation of the StaticPriorities queue strategy.

QueueStrategy m LCFS => DequeueStrategy m LCFS

An implementation of the LCFS queue strategy.

QueueStrategy m FCFS => DequeueStrategy m FCFS

An implementation of the FCFS queue strategy.

class DequeueStrategy m s => EnqueueStrategy m s where Source

It defines a strategy when we can enqueue a single element.

Methods

strategyEnqueue Source

Arguments

:: StrategyQueue m s a

the queue

-> a

the element to be enqueued

-> Event m ()

the action of enqueuing

Enqueue an element.

Instances

DequeueStrategy m SIRO => EnqueueStrategy m SIRO

An implementation of the SIRO queue strategy.

DequeueStrategy m LCFS => EnqueueStrategy m LCFS

An implementation of the LCFS queue strategy.

DequeueStrategy m FCFS => EnqueueStrategy m FCFS

An implementation of the FCFS queue strategy.

class DequeueStrategy m s => PriorityQueueStrategy m s p | s -> p where Source

It defines a strategy when we can enqueue an element with the specified priority.

Methods

strategyEnqueueWithPriority Source

Arguments

:: StrategyQueue m s a

the queue

-> p

the priority

-> a

the element to be enqueued

-> Event m ()

the action of enqueuing

Enqueue an element with the specified priority.

Instances

data FCFS Source

Strategy: First Come - First Served (FCFS).

Constructors

FCFS 

Instances

Eq FCFS 
Ord FCFS 
Show FCFS 
DequeueStrategy m FCFS => EnqueueStrategy m FCFS

An implementation of the FCFS queue strategy.

QueueStrategy m FCFS => DequeueStrategy m FCFS

An implementation of the FCFS queue strategy.

MonadComp m => QueueStrategy m FCFS

An implementation of the FCFS queue strategy.

ResultItemable (ResultValue FCFS) 
data StrategyQueue m FCFS = FCFSQueue (DoubleLinkedList m a) 

data LCFS Source

Strategy: Last Come - First Served (LCFS)

Constructors

LCFS 

Instances

Eq LCFS 
Ord LCFS 
Show LCFS 
DequeueStrategy m LCFS => EnqueueStrategy m LCFS

An implementation of the LCFS queue strategy.

QueueStrategy m LCFS => DequeueStrategy m LCFS

An implementation of the LCFS queue strategy.

MonadComp m => QueueStrategy m LCFS

An implementation of the LCFS queue strategy.

ResultItemable (ResultValue LCFS) 
data StrategyQueue m LCFS = LCFSQueue (DoubleLinkedList m a) 

data SIRO Source

Strategy: Service in Random Order (SIRO).

Constructors

SIRO 

Instances

Eq SIRO 
Ord SIRO 
Show SIRO 
DequeueStrategy m SIRO => EnqueueStrategy m SIRO

An implementation of the SIRO queue strategy.

QueueStrategy m SIRO => DequeueStrategy m SIRO

An implementation of the SIRO queue strategy.

MonadComp m => QueueStrategy m SIRO

An implementation of the SIRO queue strategy.

ResultItemable (ResultValue SIRO) 
data StrategyQueue m SIRO = SIROQueue (Vector m a)