| Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> | 
|---|---|
| License | BSD3 | 
| Maintainer | David Sorokin <david.sorokin@gmail.com> | 
| Stability | experimental | 
| Safe Haskell | Safe | 
| Language | Haskell2010 | 
Simulation.Aivika.Trans.QueueStrategy
Description
Tested with: GHC 8.0.1
This module defines the queue strategies.
- class Monad m => QueueStrategy m s where
- data StrategyQueue m s :: * -> *
 
 - class QueueStrategy m s => DequeueStrategy m s where
 - class DequeueStrategy m s => EnqueueStrategy m s where
 - class DequeueStrategy m s => PriorityQueueStrategy m s p | s -> p where
 - class DequeueStrategy m s => DeletingQueueStrategy m s where
 - data FCFS = FCFS
 - data LCFS = LCFS
 - data SIRO = SIRO
 - data StaticPriorities = StaticPriorities
 
Documentation
class Monad m => QueueStrategy m s where Source #
Defines the basic queue strategy.
Minimal complete definition
Methods
newStrategyQueue :: s -> Simulation m (StrategyQueue m s a) Source #
Create a new queue by the specified strategy.
strategyQueueNull :: StrategyQueue m s a -> Event m Bool Source #
Test whether the queue is empty.
class QueueStrategy m s => DequeueStrategy m s where Source #
Defines a strategy with support of the dequeuing operation.
Minimal complete definition
Methods
strategyDequeue :: StrategyQueue m s a -> Event m a Source #
Dequeue the front element and return it.
class DequeueStrategy m s => EnqueueStrategy m s where Source #
It defines a strategy when we can enqueue a single element.
Minimal complete definition
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.
Minimal complete definition
Methods
strategyEnqueueWithPriority :: StrategyQueue m s a -> p -> a -> Event m () Source #
Enqueue an element with the specified priority.
class DequeueStrategy m s => DeletingQueueStrategy m s where Source #
Defines a strategy with support of the deleting operation.
Minimal complete definition
Methods
strategyQueueDelete :: Eq a => StrategyQueue m s a -> a -> Event m Bool Source #
Remove the element and return a flag indicating whether the element was found and removed.
strategyQueueDeleteBy :: StrategyQueue m s a -> (a -> Bool) -> Event m (Maybe a) Source #
Remove an element satisfying the predicate and return the element if found.
strategyQueueContains :: Eq a => StrategyQueue m s a -> a -> Event m Bool Source #
Detect whether the specified element is contained in the queue.
strategyQueueContainsBy :: StrategyQueue m s a -> (a -> Bool) -> Event m (Maybe a) Source #
Detect whether an element satifying the specified predicate is contained in the queue.
Strategy: First Come - First Served (FCFS).
Constructors
| FCFS | 
Strategy: Last Come - First Served (LCFS)
Constructors
| LCFS | 
Strategy: Service in Random Order (SIRO).
Constructors
| SIRO | 
data StaticPriorities Source #
Strategy: Static Priorities. It uses the priority queue.
Constructors
| StaticPriorities |