{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}

-- |
-- Module     : Simulation.Aivika.Trans.GPSS.Results.Transform
-- Copyright  : Copyright (c) 2017, David Sorokin <david.sorokin@gmail.com>
-- License    : BSD3
-- Maintainer : David Sorokin <david.sorokin@gmail.com>
-- Stability  : experimental
-- Tested with: GHC 8.0.2
--
-- The module defines transformations for the simulation results.
--
module Simulation.Aivika.Trans.GPSS.Results.Transform where

import Control.Category

import Simulation.Aivika.Trans
import qualified Simulation.Aivika.Trans.Results.Transform as T

import qualified Simulation.Aivika.Trans.GPSS.Queue as Q
import qualified Simulation.Aivika.Trans.GPSS.Facility as F
import qualified Simulation.Aivika.Trans.GPSS.Storage as S
import Simulation.Aivika.Trans.GPSS.Results
import Simulation.Aivika.Trans.GPSS.Results.Locale

-- | Represents the 'Q.Queue'.
newtype Queue m = Queue (ResultTransform m)

-- | An instance of the result transformer.
instance T.ResultTransformer Queue m where
  tr :: Queue m -> ResultTransform m
tr (Queue ResultTransform m
a) = ResultTransform m
a

-- | Property 'Q.queueNull'.
queueNull :: Queue m -> ResultTransform m
queueNull :: Queue m -> ResultTransform m
queueNull (Queue ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
queueNullId

-- | Property 'Q.queueContent'.
queueContent :: Queue m -> ResultTransform m
queueContent :: Queue m -> ResultTransform m
queueContent (Queue ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
queueContentId

-- | Property 'Q.queueContentStats'.
queueContentStats :: Queue m -> T.TimingStats m
queueContentStats :: Queue m -> TimingStats m
queueContentStats (Queue ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
queueContentStatsId)

-- | Property 'Q.enqueueCount'.
enqueueCount :: Queue m -> ResultTransform m
enqueueCount :: Queue m -> ResultTransform m
enqueueCount (Queue ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
enqueueCountId

-- | Property 'Q.enqueueZeroEntryCount'.
enqueueZeroEntryCount :: Queue m -> ResultTransform m
enqueueZeroEntryCount :: Queue m -> ResultTransform m
enqueueZeroEntryCount (Queue ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
enqueueZeroEntryCountId

-- | Property 'Q.queueWaitTime'.
queueWaitTime :: Queue m -> T.SamplingStats m
queueWaitTime :: Queue m -> SamplingStats m
queueWaitTime (Queue ResultTransform m
a) =
  ResultTransform m -> SamplingStats m
forall (m :: * -> *). ResultTransform m -> SamplingStats m
T.SamplingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
queueWaitTimeId)

-- | Property 'Q.queueNonZeroEntryWaitTime'.
queueNonZeroEntryWaitTime :: Queue m -> T.SamplingStats m
queueNonZeroEntryWaitTime :: Queue m -> SamplingStats m
queueNonZeroEntryWaitTime (Queue ResultTransform m
a) =
  ResultTransform m -> SamplingStats m
forall (m :: * -> *). ResultTransform m -> SamplingStats m
T.SamplingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
queueNonZeroEntryWaitTimeId)

-- | Property 'Q.queueRate'.
queueRate :: Queue m -> ResultTransform m
queueRate :: Queue m -> ResultTransform m
queueRate (Queue ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
queueRateId

-- | Represents the 'F.Facility'.
newtype Facility m = Facility (ResultTransform m)

-- | An instance of the result transformer.
instance T.ResultTransformer Facility m where
  tr :: Facility m -> ResultTransform m
tr (Facility ResultTransform m
a) = ResultTransform m
a

-- | Property 'F.facilityCount'.
facilityCount :: Facility m -> ResultTransform m
facilityCount :: Facility m -> ResultTransform m
facilityCount (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityCountId

-- | Property 'F.facilityCountStats'.
facilityCountStats :: Facility m -> T.TimingStats m
facilityCountStats :: Facility m -> TimingStats m
facilityCountStats (Facility ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityCountStatsId)

-- | Property 'F.facilityCaptureCount'.
facilityCaptureCount :: Facility m -> ResultTransform m
facilityCaptureCount :: Facility m -> ResultTransform m
facilityCaptureCount (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityCaptureCountId

-- | Property 'F.facilityUtilisationCount'.
facilityUtilisationCount :: Facility m -> ResultTransform m
facilityUtilisationCount :: Facility m -> ResultTransform m
facilityUtilisationCount (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityUtilisationCountId

-- | Property 'F.facilityUtilisationCountStats'.
facilityUtilisationCountStats :: Facility m -> T.TimingStats m
facilityUtilisationCountStats :: Facility m -> TimingStats m
facilityUtilisationCountStats (Facility ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityUtilisationCountStatsId)

-- | Property 'F.facilityQueueCount'.
facilityQueueCount :: Facility m -> ResultTransform m
facilityQueueCount :: Facility m -> ResultTransform m
facilityQueueCount (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityQueueCountId

-- | Property 'F.facilityQueueCountStats'.
facilityQueueCountStats :: Facility m -> T.TimingStats m
facilityQueueCountStats :: Facility m -> TimingStats m
facilityQueueCountStats (Facility ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityQueueCountStatsId)

-- | Property 'F.facilityTotalWaitTime'.
facilityTotalWaitTime :: Facility m -> ResultTransform m
facilityTotalWaitTime :: Facility m -> ResultTransform m
facilityTotalWaitTime (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityTotalWaitTimeId

-- | Property 'F.facilityWaitTime'.
facilityWaitTime :: Facility m -> T.SamplingStats m
facilityWaitTime :: Facility m -> SamplingStats m
facilityWaitTime (Facility ResultTransform m
a) =
  ResultTransform m -> SamplingStats m
forall (m :: * -> *). ResultTransform m -> SamplingStats m
T.SamplingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityWaitTimeId)

-- | Property 'F.facilityTotalHoldingTime'.
facilityTotalHoldingTime :: Facility m -> ResultTransform m
facilityTotalHoldingTime :: Facility m -> ResultTransform m
facilityTotalHoldingTime (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityTotalHoldingTimeId

-- | Property 'F.facilityHoldingTime'.
facilityHoldingTime :: Facility m -> T.SamplingStats m
facilityHoldingTime :: Facility m -> SamplingStats m
facilityHoldingTime (Facility ResultTransform m
a) =
  ResultTransform m -> SamplingStats m
forall (m :: * -> *). ResultTransform m -> SamplingStats m
T.SamplingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityHoldingTimeId)

-- | Property 'F.facilityInterrupted'.
facilityInterrupted :: Facility m -> ResultTransform m
facilityInterrupted :: Facility m -> ResultTransform m
facilityInterrupted (Facility ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
facilityInterruptedId

-- | Represents the 'S.Storage'.
newtype Storage m = Storage (ResultTransform m)

-- | An instance of the result transformer.
instance T.ResultTransformer Storage m where
  tr :: Storage m -> ResultTransform m
tr (Storage ResultTransform m
a) = ResultTransform m
a

-- | Property 'S.storageCapacity'.
storageCapacity :: Storage m -> ResultTransform m
storageCapacity :: Storage m -> ResultTransform m
storageCapacity (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageCapacityId

-- | Property 'S.storageEmpty'.
storageEmpty :: Storage m -> ResultTransform m
storageEmpty :: Storage m -> ResultTransform m
storageEmpty (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageEmptyId

-- | Property 'S.storageFull'.
storageFull :: Storage m -> ResultTransform m
storageFull :: Storage m -> ResultTransform m
storageFull (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageFullId

-- | Property 'S.storageContent'.
storageContent :: Storage m -> ResultTransform m
storageContent :: Storage m -> ResultTransform m
storageContent (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageContentId

-- | Property 'S.storageContentStats'.
storageContentStats :: Storage m -> T.TimingStats m
storageContentStats :: Storage m -> TimingStats m
storageContentStats (Storage ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageContentStatsId)

-- | Property 'S.storageUseCount'.
storageUseCount :: Storage m -> ResultTransform m
storageUseCount :: Storage m -> ResultTransform m
storageUseCount (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageUseCountId

-- | Property 'S.storageUsedContent'.
storageUsedContent :: Storage m -> ResultTransform m
storageUsedContent :: Storage m -> ResultTransform m
storageUsedContent (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageUsedContentId

-- | Property 'S.storageUtilisationCount'.
storageUtilisationCount :: Storage m -> ResultTransform m
storageUtilisationCount :: Storage m -> ResultTransform m
storageUtilisationCount (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageUtilisationCountId

-- | Property 'S.storageUtilisationCountStats'.
storageUtilisationCountStats :: Storage m -> T.TimingStats m
storageUtilisationCountStats :: Storage m -> TimingStats m
storageUtilisationCountStats (Storage ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageUtilisationCountStatsId)

-- | Property 'S.storageQueueCount'.
storageQueueCount :: Storage m -> ResultTransform m
storageQueueCount :: Storage m -> ResultTransform m
storageQueueCount (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageQueueCountId

-- | Property 'S.storageQueueCountStats'.
storageQueueCountStats :: Storage m -> T.TimingStats m
storageQueueCountStats :: Storage m -> TimingStats m
storageQueueCountStats (Storage ResultTransform m
a) =
  ResultTransform m -> TimingStats m
forall (m :: * -> *). ResultTransform m -> TimingStats m
T.TimingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageQueueCountStatsId)

-- | Property 'S.storageTotalWaitTime'.
storageTotalWaitTime :: Storage m -> ResultTransform m
storageTotalWaitTime :: Storage m -> ResultTransform m
storageTotalWaitTime (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageTotalWaitTimeId

-- | Property 'S.storageWaitTime'.
storageWaitTime :: Storage m -> T.SamplingStats m
storageWaitTime :: Storage m -> SamplingStats m
storageWaitTime (Storage ResultTransform m
a) =
  ResultTransform m -> SamplingStats m
forall (m :: * -> *). ResultTransform m -> SamplingStats m
T.SamplingStats (ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageWaitTimeId)

-- | Property 'S.storageAverageHoldingTime'.
storageAverageHoldingTime :: Storage m -> ResultTransform m
storageAverageHoldingTime :: Storage m -> ResultTransform m
storageAverageHoldingTime (Storage ResultTransform m
a) =
  ResultTransform m
a ResultTransform m -> ResultTransform m -> ResultTransform m
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ResultId -> ResultTransform m
forall (m :: * -> *). ResultId -> ResultTransform m
resultById ResultId
storageAverageHoldingTimeId