aivika-5.9: A multi-method simulation library

CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Simulation.Aivika.QueueStrategy

Description

Tested with: GHC 8.0.1

This module defines the queue strategies.

Synopsis

Documentation

class QueueStrategy s where Source #

Defines the basic queue strategy.

Associated Types

data StrategyQueue s :: * -> * Source #

A queue used by the strategy.

Methods

newStrategyQueue Source #

Arguments

:: s

the strategy

-> Simulation (StrategyQueue s i)

a new queue

Create a new queue by the specified strategy.

strategyQueueNull Source #

Arguments

:: StrategyQueue s i

the queue

-> Event Bool

the result of the test

Test whether the queue is empty.

Instances
QueueStrategy StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue StaticPriorities a :: Type Source #

QueueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue SIRO a :: Type Source #

QueueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue LCFS a :: Type Source #

QueueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue FCFS a :: Type Source #

class QueueStrategy s => DequeueStrategy s where Source #

Defines a strategy with support of the dequeuing operation.

Methods

strategyDequeue Source #

Arguments

:: StrategyQueue s i

the queue

-> Event i

the dequeued element

Dequeue the front element and return it.

Instances
DequeueStrategy StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

class DequeueStrategy s => EnqueueStrategy s where Source #

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

Methods

strategyEnqueue Source #

Arguments

:: StrategyQueue s i

the queue

-> i

the element to be enqueued

-> Event ()

the action of enqueuing

Enqueue an element.

Instances
EnqueueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

EnqueueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

EnqueueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

class DequeueStrategy s => PriorityQueueStrategy 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 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 Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

class DequeueStrategy s => DeletingQueueStrategy s where Source #

Defines a strategy with support of the deleting operation.

Methods

strategyQueueDelete Source #

Arguments

:: Eq i 
=> StrategyQueue s i

the queue

-> i

the element

-> Event Bool

whether the element was found and removed

Remove the element and return a flag indicating whether the element was found and removed.

strategyQueueDeleteBy Source #

Arguments

:: StrategyQueue s i

the queue

-> (i -> Bool)

the predicate

-> Event (Maybe i)

the element if it was found and removed

Remove an element satisfying the predicate and return the element if found.

strategyQueueContains Source #

Arguments

:: Eq i 
=> StrategyQueue s i

the queue

-> i

the element to find

-> Event Bool

whether the element is contained in the queue

Detect whether the specified element is contained in the queue.

strategyQueueContainsBy Source #

Arguments

:: StrategyQueue s i

the queue

-> (i -> Bool)

the predicate

-> Event (Maybe i)

the element if it was found

Detect whether an element satifying the specified predicate is contained in the queue.

Instances
DeletingQueueStrategy StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DeletingQueueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DeletingQueueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DeletingQueueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

data FCFS Source #

Strategy: First Come - First Served (FCFS).

Constructors

FCFS 
Instances
Eq FCFS Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

(==) :: FCFS -> FCFS -> Bool #

(/=) :: FCFS -> FCFS -> Bool #

Ord FCFS Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

compare :: FCFS -> FCFS -> Ordering #

(<) :: FCFS -> FCFS -> Bool #

(<=) :: FCFS -> FCFS -> Bool #

(>) :: FCFS -> FCFS -> Bool #

(>=) :: FCFS -> FCFS -> Bool #

max :: FCFS -> FCFS -> FCFS #

min :: FCFS -> FCFS -> FCFS #

Show FCFS Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

showsPrec :: Int -> FCFS -> ShowS #

show :: FCFS -> String #

showList :: [FCFS] -> ShowS #

DeletingQueueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

EnqueueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

QueueStrategy FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue FCFS a :: Type Source #

ResultItemable (ResultValue FCFS) Source # 
Instance details

Defined in Simulation.Aivika.Results

data StrategyQueue FCFS i Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

data LCFS Source #

Strategy: Last Come - First Served (LCFS)

Constructors

LCFS 
Instances
Eq LCFS Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

(==) :: LCFS -> LCFS -> Bool #

(/=) :: LCFS -> LCFS -> Bool #

Ord LCFS Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

compare :: LCFS -> LCFS -> Ordering #

(<) :: LCFS -> LCFS -> Bool #

(<=) :: LCFS -> LCFS -> Bool #

(>) :: LCFS -> LCFS -> Bool #

(>=) :: LCFS -> LCFS -> Bool #

max :: LCFS -> LCFS -> LCFS #

min :: LCFS -> LCFS -> LCFS #

Show LCFS Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

showsPrec :: Int -> LCFS -> ShowS #

show :: LCFS -> String #

showList :: [LCFS] -> ShowS #

DeletingQueueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

EnqueueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

QueueStrategy LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue LCFS a :: Type Source #

ResultItemable (ResultValue LCFS) Source # 
Instance details

Defined in Simulation.Aivika.Results

data StrategyQueue LCFS i Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

data SIRO Source #

Strategy: Service in Random Order (SIRO).

Constructors

SIRO 
Instances
Eq SIRO Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

(==) :: SIRO -> SIRO -> Bool #

(/=) :: SIRO -> SIRO -> Bool #

Ord SIRO Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

compare :: SIRO -> SIRO -> Ordering #

(<) :: SIRO -> SIRO -> Bool #

(<=) :: SIRO -> SIRO -> Bool #

(>) :: SIRO -> SIRO -> Bool #

(>=) :: SIRO -> SIRO -> Bool #

max :: SIRO -> SIRO -> SIRO #

min :: SIRO -> SIRO -> SIRO #

Show SIRO Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Methods

showsPrec :: Int -> SIRO -> ShowS #

show :: SIRO -> String #

showList :: [SIRO] -> ShowS #

DeletingQueueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

EnqueueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

QueueStrategy SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue SIRO a :: Type Source #

ResultItemable (ResultValue SIRO) Source # 
Instance details

Defined in Simulation.Aivika.Results

data StrategyQueue SIRO i Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

data StaticPriorities Source #

Strategy: Static Priorities. It uses the priority queue.

Constructors

StaticPriorities 
Instances
Eq StaticPriorities Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Ord StaticPriorities Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

Show StaticPriorities Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy

DeletingQueueStrategy StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

DequeueStrategy StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

QueueStrategy StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

Associated Types

data StrategyQueue StaticPriorities a :: Type Source #

PriorityQueueStrategy StaticPriorities Double Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.QueueStrategy

ResultItemable (ResultValue StaticPriorities) Source # 
Instance details

Defined in Simulation.Aivika.Results

data StrategyQueue StaticPriorities i Source # 
Instance details

Defined in Simulation.Aivika.QueueStrategy