aivika-2.0: A multi-paradigm simulation library

Stabilityexperimental
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Safe HaskellSafe-Inferred

Simulation.Aivika.QueueStrategy

Description

Tested with: GHC 7.8.3

This module defines the queue strategies.

Synopsis

Documentation

class QueueStrategy s whereSource

Defines the basic queue strategy.

Associated Types

data StrategyQueue s :: * -> *Source

A queue used by the strategy.

Methods

newStrategyQueueSource

Arguments

:: s

the strategy

-> Simulation (StrategyQueue s i)

a new queue

Create a new queue by the specified strategy.

strategyQueueNullSource

Arguments

:: StrategyQueue s i

the queue

-> Event Bool

the result of the test

Test whether the queue is empty.

Instances

QueueStrategy StaticPriorities

An implementation of the StaticPriorities queue strategy.

QueueStrategy SIRO

An implementation of the SIRO queue strategy.

QueueStrategy LCFS

An implementation of the LCFS queue strategy.

QueueStrategy FCFS

An implementation of the FCFS queue strategy.

class QueueStrategy s => DequeueStrategy s whereSource

Defines a strategy with support of the dequeuing operation.

Methods

strategyDequeueSource

Arguments

:: StrategyQueue s i

the queue

-> Event i

the dequeued element

Dequeue the front element and return it.

Instances

DequeueStrategy StaticPriorities

An implementation of the StaticPriorities queue strategy.

DequeueStrategy SIRO

An implementation of the SIRO queue strategy.

DequeueStrategy LCFS

An implementation of the LCFS queue strategy.

DequeueStrategy FCFS

An implementation of the FCFS queue strategy.

class DequeueStrategy s => EnqueueStrategy s whereSource

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

Methods

strategyEnqueueSource

Arguments

:: StrategyQueue s i

the queue

-> i

the element to be enqueued

-> Event ()

the action of enqueuing

Enqueue an element.

Instances

EnqueueStrategy SIRO

An implementation of the SIRO queue strategy.

EnqueueStrategy LCFS

An implementation of the LCFS queue strategy.

EnqueueStrategy FCFS

An implementation of the FCFS queue strategy.

class DequeueStrategy s => PriorityQueueStrategy s p | s -> p whereSource

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

Methods

strategyEnqueueWithPrioritySource

Arguments

:: StrategyQueue s i

the queue

-> p

the priority

-> i

the element to be enqueued

-> Event ()

the action of enqueuing

Enqueue an element with the specified priority.

Instances

PriorityQueueStrategy StaticPriorities Double

An implementation of the StaticPriorities queue strategy.

data FCFS Source

Strategy: First Come - First Served (FCFS).

Constructors

FCFS 

Instances

Eq FCFS 
Ord FCFS 
Show FCFS 
EnqueueStrategy FCFS

An implementation of the FCFS queue strategy.

DequeueStrategy FCFS

An implementation of the FCFS queue strategy.

QueueStrategy FCFS

An implementation of the FCFS queue strategy.

ResultItemable (ResultValue FCFS) 

data LCFS Source

Strategy: Last Come - First Served (LCFS)

Constructors

LCFS 

Instances

Eq LCFS 
Ord LCFS 
Show LCFS 
EnqueueStrategy LCFS

An implementation of the LCFS queue strategy.

DequeueStrategy LCFS

An implementation of the LCFS queue strategy.

QueueStrategy LCFS

An implementation of the LCFS queue strategy.

ResultItemable (ResultValue LCFS) 

data SIRO Source

Strategy: Service in Random Order (SIRO).

Constructors

SIRO 

Instances

Eq SIRO 
Ord SIRO 
Show SIRO 
EnqueueStrategy SIRO

An implementation of the SIRO queue strategy.

DequeueStrategy SIRO

An implementation of the SIRO queue strategy.

QueueStrategy SIRO

An implementation of the SIRO queue strategy.

ResultItemable (ResultValue SIRO) 

data StaticPriorities Source

Strategy: Static Priorities. It uses the priority queue.

Constructors

StaticPriorities 

Instances

Eq StaticPriorities 
Ord StaticPriorities 
Show StaticPriorities 
DequeueStrategy StaticPriorities

An implementation of the StaticPriorities queue strategy.

QueueStrategy StaticPriorities

An implementation of the StaticPriorities queue strategy.

PriorityQueueStrategy StaticPriorities Double

An implementation of the StaticPriorities queue strategy.

ResultItemable (ResultValue StaticPriorities)