aivika-1.0: A multi-paradigm simulation library

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

Simulation.Aivika.QueueStrategy

Contents

Description

Tested with: GHC 7.6.3

This module defines the queue strategies.

Synopsis

Strategy Classes

class QueueStrategy s q | s -> q where Source

Defines the basic queue strategy.

Methods

newStrategyQueue Source

Arguments

:: s

the strategy

-> Simulation (q i)

a new queue

Create a new queue by the specified strategy.

strategyQueueNull Source

Arguments

:: s

the strategy

-> q i

the queue

-> Event Bool

the result of the test

Test whether the queue is empty.

class QueueStrategy s q => DequeueStrategy s q | s -> q where Source

Defines a strategy with support of the dequeuing operation.

Methods

strategyDequeue Source

Arguments

:: s

the strategy

-> q i

the queue

-> Event i

the dequeued element

Dequeue the front element and return it.

class DequeueStrategy s q => EnqueueStrategy s q | s -> q where Source

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

Methods

strategyEnqueue Source

Arguments

:: s

the strategy

-> q i

the queue

-> i

the element to be enqueued

-> Event ()

the action of enqueuing

Enqueue an element.

class DequeueStrategy s q => PriorityQueueStrategy s q p | s -> q, s -> p where Source

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

Methods

strategyEnqueueWithPriority Source

Arguments

:: s

the strategy

-> q i

the queue

-> p

the priority

-> i

the element to be enqueued

-> Event ()

the action of enqueuing

Enqueue an element with the specified priority.

Strategy Instances

data FCFS Source

Strategy: First Come - First Served (FCFS).

Constructors

FCFS 

data SIRO Source

Strategy: Service in Random Order (SIRO).

Constructors

SIRO