aivika-transformers-5.9.1: Transformers for the Aivika 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.Trans.QueueStrategy

Description

Tested with: GHC 8.0.1

This module defines the queue strategies.

Synopsis

Documentation

class Monad 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

Instances details
QueueStrategy IO StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO StaticPriorities :: Type -> Type Source #

QueueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO SIRO :: Type -> Type Source #

QueueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO LCFS :: Type -> Type Source #

QueueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO FCFS :: Type -> Type Source #

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

Instances details
DequeueStrategy IO StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

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

Instances details
EnqueueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

EnqueueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

EnqueueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

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

Instances details
PriorityQueueStrategy IO StaticPriorities Double Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

class DequeueStrategy m s => DeletingQueueStrategy m s where Source #

Defines a strategy with support of the deleting operation.

Methods

strategyQueueDelete Source #

Arguments

:: Eq a 
=> StrategyQueue m s a

the queue

-> a

the element

-> Event m 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 m s a

the queue

-> (a -> Bool)

the predicate

-> Event m (Maybe a)

the element if it was found and removed

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

strategyQueueContains Source #

Arguments

:: Eq a 
=> StrategyQueue m s a

the queue

-> a

the element to find

-> Event m Bool

whether the element is contained in the queue

Detect whether the specified element is contained in the queue.

strategyQueueContainsBy Source #

Arguments

:: StrategyQueue m s a

the queue

-> (a -> Bool)

the predicate

-> Event m (Maybe a)

the element if it was found

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

Instances

Instances details
DeletingQueueStrategy IO StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DeletingQueueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DeletingQueueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DeletingQueueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

data FCFS Source #

Strategy: First Come - First Served (FCFS).

Constructors

FCFS 

Instances

Instances details
Eq FCFS Source # 
Instance details

Defined in Simulation.Aivika.Trans.QueueStrategy

Methods

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

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

Ord FCFS Source # 
Instance details

Defined in Simulation.Aivika.Trans.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.Trans.QueueStrategy

Methods

showsPrec :: Int -> FCFS -> ShowS #

show :: FCFS -> String #

showList :: [FCFS] -> ShowS #

DeletingQueueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

EnqueueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

QueueStrategy IO FCFS Source #

An implementation of the FCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO FCFS :: Type -> Type Source #

ResultItemable (ResultValue FCFS) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: forall (m :: Type -> Type). ResultValue FCFS m -> ResultName Source #

resultItemNamePath :: forall (m :: Type -> Type). ResultValue FCFS m -> [ResultName] Source #

resultItemId :: forall (m :: Type -> Type). ResultValue FCFS m -> ResultId Source #

resultItemIdPath :: forall (m :: Type -> Type). ResultValue FCFS m -> [ResultId] Source #

resultItemSignal :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> ResultSignal m Source #

resultItemExpansion :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> ResultSource m Source #

resultItemSummary :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> ResultSource m Source #

resultItemAsIntValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: forall (m :: Type -> Type). MonadDES m => ResultValue FCFS m -> Maybe (ResultValue String m) Source #

newtype StrategyQueue IO FCFS a Source # 
Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

data LCFS Source #

Strategy: Last Come - First Served (LCFS)

Constructors

LCFS 

Instances

Instances details
Eq LCFS Source # 
Instance details

Defined in Simulation.Aivika.Trans.QueueStrategy

Methods

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

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

Ord LCFS Source # 
Instance details

Defined in Simulation.Aivika.Trans.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.Trans.QueueStrategy

Methods

showsPrec :: Int -> LCFS -> ShowS #

show :: LCFS -> String #

showList :: [LCFS] -> ShowS #

DeletingQueueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

EnqueueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

QueueStrategy IO LCFS Source #

An implementation of the LCFS queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO LCFS :: Type -> Type Source #

ResultItemable (ResultValue LCFS) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: forall (m :: Type -> Type). ResultValue LCFS m -> ResultName Source #

resultItemNamePath :: forall (m :: Type -> Type). ResultValue LCFS m -> [ResultName] Source #

resultItemId :: forall (m :: Type -> Type). ResultValue LCFS m -> ResultId Source #

resultItemIdPath :: forall (m :: Type -> Type). ResultValue LCFS m -> [ResultId] Source #

resultItemSignal :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> ResultSignal m Source #

resultItemExpansion :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> ResultSource m Source #

resultItemSummary :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> ResultSource m Source #

resultItemAsIntValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: forall (m :: Type -> Type). MonadDES m => ResultValue LCFS m -> Maybe (ResultValue String m) Source #

newtype StrategyQueue IO LCFS a Source # 
Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

data SIRO Source #

Strategy: Service in Random Order (SIRO).

Constructors

SIRO 

Instances

Instances details
Eq SIRO Source # 
Instance details

Defined in Simulation.Aivika.Trans.QueueStrategy

Methods

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

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

Ord SIRO Source # 
Instance details

Defined in Simulation.Aivika.Trans.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.Trans.QueueStrategy

Methods

showsPrec :: Int -> SIRO -> ShowS #

show :: SIRO -> String #

showList :: [SIRO] -> ShowS #

DeletingQueueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

EnqueueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

QueueStrategy IO SIRO Source #

An implementation of the SIRO queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO SIRO :: Type -> Type Source #

ResultItemable (ResultValue SIRO) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: forall (m :: Type -> Type). ResultValue SIRO m -> ResultName Source #

resultItemNamePath :: forall (m :: Type -> Type). ResultValue SIRO m -> [ResultName] Source #

resultItemId :: forall (m :: Type -> Type). ResultValue SIRO m -> ResultId Source #

resultItemIdPath :: forall (m :: Type -> Type). ResultValue SIRO m -> [ResultId] Source #

resultItemSignal :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> ResultSignal m Source #

resultItemExpansion :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> ResultSource m Source #

resultItemSummary :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> ResultSource m Source #

resultItemAsIntValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: forall (m :: Type -> Type). MonadDES m => ResultValue SIRO m -> Maybe (ResultValue String m) Source #

newtype StrategyQueue IO SIRO a Source # 
Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

data StaticPriorities Source #

Strategy: Static Priorities. It uses the priority queue.

Constructors

StaticPriorities 

Instances

Instances details
Eq StaticPriorities Source # 
Instance details

Defined in Simulation.Aivika.Trans.QueueStrategy

Ord StaticPriorities Source # 
Instance details

Defined in Simulation.Aivika.Trans.QueueStrategy

Show StaticPriorities Source # 
Instance details

Defined in Simulation.Aivika.Trans.QueueStrategy

DeletingQueueStrategy IO StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

DequeueStrategy IO StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

QueueStrategy IO StaticPriorities Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

Associated Types

data StrategyQueue IO StaticPriorities :: Type -> Type Source #

PriorityQueueStrategy IO StaticPriorities Double Source #

An implementation of the StaticPriorities queue strategy.

Instance details

Defined in Simulation.Aivika.IO.QueueStrategy

ResultItemable (ResultValue StaticPriorities) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: forall (m :: Type -> Type). ResultValue StaticPriorities m -> ResultName Source #

resultItemNamePath :: forall (m :: Type -> Type). ResultValue StaticPriorities m -> [ResultName] Source #

resultItemId :: forall (m :: Type -> Type). ResultValue StaticPriorities m -> ResultId Source #

resultItemIdPath :: forall (m :: Type -> Type). ResultValue StaticPriorities m -> [ResultId] Source #

resultItemSignal :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> ResultSignal m Source #

resultItemExpansion :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> ResultSource m Source #

resultItemSummary :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> ResultSource m Source #

resultItemAsIntValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: forall (m :: Type -> Type). MonadDES m => ResultValue StaticPriorities m -> Maybe (ResultValue String m) Source #

newtype StrategyQueue IO StaticPriorities a Source # 
Instance details

Defined in Simulation.Aivika.IO.QueueStrategy