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