{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances, ExistentialQuantification, MultiParamTypeClasses, FunctionalDependencies, OverlappingInstances #-}

-- |
-- Module     : Simulation.Aivika.Trans.Results
-- Copyright  : Copyright (c) 2009-2017, David Sorokin <david.sorokin@gmail.com>
-- License    : BSD3
-- Maintainer : David Sorokin <david.sorokin@gmail.com>
-- Stability  : experimental
-- Tested with: GHC 8.0.1
--
-- The module allows exporting the simulation results from the model.
--
module Simulation.Aivika.Trans.Results
       (-- * Definitions Focused on Modeling
        Results,
        ResultTransform,
        ResultName,
        ResultProvider(..),
        results,
        expandResults,
        resultSummary,
        resultByName,
        resultByProperty,
        resultById,
        resultByIndex,
        resultBySubscript,
        ResultComputing(..),
        ResultListWithSubscript(..),
        ResultArrayWithSubscript(..),
        ResultVectorWithSubscript(..),
        -- * Definitions Focused on Using the Library
        ResultValue(..),
        resultsToIntValues,
        resultsToIntListValues,
        resultsToIntStatsValues,
        resultsToIntStatsEitherValues,
        resultsToIntTimingStatsValues,
        resultsToDoubleValues,
        resultsToDoubleListValues,
        resultsToDoubleStatsValues,
        resultsToDoubleStatsEitherValues,
        resultsToDoubleTimingStatsValues,
        resultsToStringValues,
        ResultPredefinedSignals(..),
        newResultPredefinedSignals,
        resultSignal,
        pureResultSignal,
        -- * Definitions Focused on Extending the Library 
        ResultSourceMap,
        ResultSource(..),
        ResultItem(..),
        ResultItemable(..),
        resultItemAsIntStatsEitherValue,
        resultItemAsDoubleStatsEitherValue,
        resultItemToIntValue,
        resultItemToIntListValue,
        resultItemToIntStatsValue,
        resultItemToIntStatsEitherValue,
        resultItemToIntTimingStatsValue,
        resultItemToDoubleValue,
        resultItemToDoubleListValue,
        resultItemToDoubleStatsValue,
        resultItemToDoubleStatsEitherValue,
        resultItemToDoubleTimingStatsValue,
        resultItemToStringValue,
        ResultObject(..),
        ResultProperty(..),
        ResultVector(..),
        memoResultVectorSignal,
        memoResultVectorSummary,
        ResultSeparator(..),
        ResultContainer(..),
        resultContainerPropertySource,
        resultContainerConstProperty,
        resultContainerIntegProperty,
        resultContainerProperty,
        resultContainerMapProperty,
        resultValueToContainer,
        resultContainerToValue,
        ResultData,
        ResultSignal(..),
        maybeResultSignal,
        textResultSource,
        timeResultSource,
        resultSourceToIntValues,
        resultSourceToIntListValues,
        resultSourceToIntStatsValues,
        resultSourceToIntStatsEitherValues,
        resultSourceToIntTimingStatsValues,
        resultSourceToDoubleValues,
        resultSourceToDoubleListValues,
        resultSourceToDoubleStatsValues,
        resultSourceToDoubleStatsEitherValues,
        resultSourceToDoubleTimingStatsValues,
        resultSourceToStringValues,
        resultSourceMap,
        resultSourceList,
        composeResults,
        computeResultValue) where

import Control.Monad
import Control.Monad.Trans

import qualified Data.Map as M
import qualified Data.Array as A
import qualified Data.Vector as V

import Data.Ix
import Data.Maybe
import Data.Monoid hiding ((<>))
import Data.Semigroup (Semigroup(..))

import Simulation.Aivika.Trans.Parameter
import Simulation.Aivika.Trans.Simulation
import Simulation.Aivika.Trans.Dynamics
import Simulation.Aivika.Trans.Event
import Simulation.Aivika.Trans.Signal
import Simulation.Aivika.Trans.Statistics
import Simulation.Aivika.Trans.Statistics.Accumulator
import Simulation.Aivika.Trans.Ref
import qualified Simulation.Aivika.Trans.Ref.Base as B
import Simulation.Aivika.Trans.Var
import Simulation.Aivika.Trans.QueueStrategy
import qualified Simulation.Aivika.Trans.Queue as Q
import qualified Simulation.Aivika.Trans.Queue.Infinite as IQ
import Simulation.Aivika.Trans.Arrival
import Simulation.Aivika.Trans.Server
import Simulation.Aivika.Trans.Activity
import Simulation.Aivika.Trans.Operation
import Simulation.Aivika.Trans.Results.Locale.Types
import Simulation.Aivika.Trans.SD
import Simulation.Aivika.Trans.DES
import Simulation.Aivika.Trans.Resource
import qualified Simulation.Aivika.Trans.Resource.Preemption as PR

-- | Represents a provider of the simulation results. It is usually something, or
-- an array of something, or a list of such values which can be simulated to get data.
class MonadDES m => ResultProvider p m | p -> m where
  
  -- | Return the source of simulation results by the specified name, description and provider. 
  resultSource :: ResultName -> ResultDescription -> p -> ResultSource m
  resultSource ResultName
name ResultName
descr = ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource m
forall p (m :: * -> *).
ResultProvider p m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource m
resultSource' ResultName
name [ResultName
name] ResultId
i [ResultId
i]
    where i :: ResultId
i = (UserDefinedResult -> ResultId
UserDefinedResultId (UserDefinedResult -> ResultId) -> UserDefinedResult -> ResultId
forall a b. (a -> b) -> a -> b
$ ResultName -> ResultName -> ResultName -> UserDefinedResult
UserDefinedResult ResultName
name ResultName
descr ResultName
title)
          title :: ResultName
title = ResultName -> ResultName
resultNameToTitle ResultName
name
  
  -- | Return the source of simulation results by the specified name, description, title and provider. 
  resultSource3 :: ResultName -> ResultDescription -> ResultDescription -> p -> ResultSource m
  resultSource3 ResultName
name ResultName
descr ResultName
title = ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource m
forall p (m :: * -> *).
ResultProvider p m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource m
resultSource' ResultName
name [ResultName
name] ResultId
i [ResultId
i]
    where i :: ResultId
i = (UserDefinedResult -> ResultId
UserDefinedResultId (UserDefinedResult -> ResultId) -> UserDefinedResult -> ResultId
forall a b. (a -> b) -> a -> b
$ ResultName -> ResultName -> ResultName -> UserDefinedResult
UserDefinedResult ResultName
name ResultName
descr ResultName
title)

  -- | Return the source of simulation results by the specified name, its name path,
  -- identifier, the corresponding indentifier path and provider. 
  resultSource' :: ResultName -> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource m

-- | It associates the result sources with their names.
type ResultSourceMap m = M.Map ResultName (ResultSource m)

-- | Encapsulates the result source.
data ResultSource m = ResultItemSource (ResultItem m)
                      -- ^ The source consisting of a single item.
                    | ResultObjectSource (ResultObject m)
                      -- ^ An object-like source.
                    | ResultVectorSource (ResultVector m)
                      -- ^ A vector-like structure.
                    | ResultSeparatorSource ResultSeparator
                      -- ^ This is a separator text.

-- | The simulation results represented by a single item.
data ResultItem m = forall a. ResultItemable a => ResultItem (a m)

-- | Represents a type class for actual representing the items.
class ResultItemable a where

  -- | The item name.
  resultItemName :: a m -> ResultName
  
  -- | The item name path.
  resultItemNamePath :: a m -> [ResultName]
  
  -- | The item identifier.
  resultItemId :: a m -> ResultId
  
  -- | The item identifier path.
  resultItemIdPath :: a m -> [ResultId]

  -- | Whether the item emits a signal.
  resultItemSignal :: MonadDES m => a m -> ResultSignal m

  -- | Return an expanded version of the item, for example,
  -- when the statistics item is exanded to an object
  -- having the corresponded properties for count, average,
  -- deviation, minimum, maximum and so on.
  resultItemExpansion :: MonadDES m => a m -> ResultSource m
  
  -- | Return usually a short version of the item, i.e. its summary,
  -- but values of some data types such as statistics can be
  -- implicitly expanded to an object with the corresponded
  -- properties.
  resultItemSummary :: MonadDES m => a m -> ResultSource m
  
  -- | Try to return integer numbers in time points.
  resultItemAsIntValue :: MonadDES m => a m -> Maybe (ResultValue Int m)

  -- | Try to return lists of integer numbers in time points. 
  resultItemAsIntListValue :: MonadDES m => a m -> Maybe (ResultValue [Int] m)

  -- | Try to return statistics based on integer numbers.
  resultItemAsIntStatsValue :: MonadDES m => a m -> Maybe (ResultValue (SamplingStats Int) m)

  -- | Try to return timing statistics based on integer numbers.
  resultItemAsIntTimingStatsValue :: MonadDES m => a m -> Maybe (ResultValue (TimingStats Int) m)

  -- | Try to return double numbers in time points.
  resultItemAsDoubleValue :: MonadDES m => a m -> Maybe (ResultValue Double m)
  
  -- | Try to return lists of double numbers in time points. 
  resultItemAsDoubleListValue :: MonadDES m => a m -> Maybe (ResultValue [Double] m)

  -- | Try to return statistics based on double numbers.
  resultItemAsDoubleStatsValue :: MonadDES m => a m -> Maybe (ResultValue (SamplingStats Double) m)

  -- | Try to return timing statistics based on integer numbers.
  resultItemAsDoubleTimingStatsValue :: MonadDES m => a m -> Maybe (ResultValue (TimingStats Double) m)

  -- | Try to return string representations in time points.
  resultItemAsStringValue :: MonadDES m => a m -> Maybe (ResultValue String m)

-- | Try to return a version optimised for fast aggregation of the statistics based on integer numbers.
resultItemAsIntStatsEitherValue :: (MonadDES m, ResultItemable a) => a m -> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
resultItemAsIntStatsEitherValue :: a m -> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
resultItemAsIntStatsEitherValue a m
x =
  case Maybe (ResultValue Int m)
x1 of
    Just ResultValue Int m
a1 -> ResultValue (Either Int (SamplingStats Int)) m
-> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
forall a. a -> Maybe a
Just (ResultValue (Either Int (SamplingStats Int)) m
 -> Maybe (ResultValue (Either Int (SamplingStats Int)) m))
-> ResultValue (Either Int (SamplingStats Int)) m
-> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
forall a b. (a -> b) -> a -> b
$ (Int -> Either Int (SamplingStats Int))
-> ResultValue Int m
-> ResultValue (Either Int (SamplingStats Int)) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Int -> Either Int (SamplingStats Int)
forall a b. a -> Either a b
Left ResultValue Int m
a1
    Maybe (ResultValue Int m)
Nothing ->
      case Maybe (ResultValue (SamplingStats Int) m)
x2 of
        Just ResultValue (SamplingStats Int) m
a2 -> ResultValue (Either Int (SamplingStats Int)) m
-> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
forall a. a -> Maybe a
Just (ResultValue (Either Int (SamplingStats Int)) m
 -> Maybe (ResultValue (Either Int (SamplingStats Int)) m))
-> ResultValue (Either Int (SamplingStats Int)) m
-> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
forall a b. (a -> b) -> a -> b
$ (SamplingStats Int -> Either Int (SamplingStats Int))
-> ResultValue (SamplingStats Int) m
-> ResultValue (Either Int (SamplingStats Int)) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SamplingStats Int -> Either Int (SamplingStats Int)
forall a b. b -> Either a b
Right ResultValue (SamplingStats Int) m
a2
        Maybe (ResultValue (SamplingStats Int) m)
Nothing -> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
forall a. Maybe a
Nothing
  where
    x1 :: Maybe (ResultValue Int m)
x1 = a m -> Maybe (ResultValue Int m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue Int m)
resultItemAsIntValue a m
x
    x2 :: Maybe (ResultValue (SamplingStats Int) m)
x2 = a m -> Maybe (ResultValue (SamplingStats Int) m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue a m
x

-- | Try to return a version optimised for fast aggregation of the statistics based on double floating point numbers.
resultItemAsDoubleStatsEitherValue :: (MonadDES m, ResultItemable a) => a m -> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
resultItemAsDoubleStatsEitherValue :: a m -> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
resultItemAsDoubleStatsEitherValue a m
x =
  case Maybe (ResultValue Double m)
x1 of
    Just ResultValue Double m
a1 -> ResultValue (Either Double (SamplingStats Double)) m
-> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
forall a. a -> Maybe a
Just (ResultValue (Either Double (SamplingStats Double)) m
 -> Maybe (ResultValue (Either Double (SamplingStats Double)) m))
-> ResultValue (Either Double (SamplingStats Double)) m
-> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
forall a b. (a -> b) -> a -> b
$ (Double -> Either Double (SamplingStats Double))
-> ResultValue Double m
-> ResultValue (Either Double (SamplingStats Double)) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Double -> Either Double (SamplingStats Double)
forall a b. a -> Either a b
Left ResultValue Double m
a1
    Maybe (ResultValue Double m)
Nothing ->
      case Maybe (ResultValue (SamplingStats Double) m)
x2 of
        Just ResultValue (SamplingStats Double) m
a2 -> ResultValue (Either Double (SamplingStats Double)) m
-> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
forall a. a -> Maybe a
Just (ResultValue (Either Double (SamplingStats Double)) m
 -> Maybe (ResultValue (Either Double (SamplingStats Double)) m))
-> ResultValue (Either Double (SamplingStats Double)) m
-> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
forall a b. (a -> b) -> a -> b
$ (SamplingStats Double -> Either Double (SamplingStats Double))
-> ResultValue (SamplingStats Double) m
-> ResultValue (Either Double (SamplingStats Double)) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SamplingStats Double -> Either Double (SamplingStats Double)
forall a b. b -> Either a b
Right ResultValue (SamplingStats Double) m
a2
        Maybe (ResultValue (SamplingStats Double) m)
Nothing -> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
forall a. Maybe a
Nothing
  where
    x1 :: Maybe (ResultValue Double m)
x1 = a m -> Maybe (ResultValue Double m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue a m
x
    x2 :: Maybe (ResultValue (SamplingStats Double) m)
x2 = a m -> Maybe (ResultValue (SamplingStats Double) m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue a m
x

-- | Return integer numbers in time points.
resultItemToIntValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue Int m
resultItemToIntValue :: a m -> ResultValue Int m
resultItemToIntValue a m
x =
  case a m -> Maybe (ResultValue Int m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue Int m)
resultItemAsIntValue a m
x of
    Just ResultValue Int m
a -> ResultValue Int m
a
    Maybe (ResultValue Int m)
Nothing ->
      ResultName -> ResultValue Int m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue Int m)
-> ResultName -> ResultValue Int m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of integer numbers: resultItemToIntValue"

-- | Return lists of integer numbers in time points. 
resultItemToIntListValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue [Int] m
resultItemToIntListValue :: a m -> ResultValue [Int] m
resultItemToIntListValue a m
x =
  case a m -> Maybe (ResultValue [Int] m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue a m
x of
    Just ResultValue [Int] m
a -> ResultValue [Int] m
a
    Maybe (ResultValue [Int] m)
Nothing ->
      ResultName -> ResultValue [Int] m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue [Int] m)
-> ResultName -> ResultValue [Int] m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of lists of integer numbers: resultItemToIntListValue"

-- | Return statistics based on integer numbers.
resultItemToIntStatsValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue (SamplingStats Int) m
resultItemToIntStatsValue :: a m -> ResultValue (SamplingStats Int) m
resultItemToIntStatsValue a m
x =
  case a m -> Maybe (ResultValue (SamplingStats Int) m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue a m
x of
    Just ResultValue (SamplingStats Int) m
a -> ResultValue (SamplingStats Int) m
a
    Maybe (ResultValue (SamplingStats Int) m)
Nothing ->
      ResultName -> ResultValue (SamplingStats Int) m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (SamplingStats Int) m)
-> ResultName -> ResultValue (SamplingStats Int) m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of statistics based on integer numbers: resultItemToIntStatsValue"

-- | Return a version optimised for fast aggregation of the statistics based on integer numbers.
resultItemToIntStatsEitherValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue (Either Int (SamplingStats Int)) m
resultItemToIntStatsEitherValue :: a m -> ResultValue (Either Int (SamplingStats Int)) m
resultItemToIntStatsEitherValue a m
x =
  case a m -> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> Maybe (ResultValue (Either Int (SamplingStats Int)) m)
resultItemAsIntStatsEitherValue a m
x of
    Just ResultValue (Either Int (SamplingStats Int)) m
a -> ResultValue (Either Int (SamplingStats Int)) m
a
    Maybe (ResultValue (Either Int (SamplingStats Int)) m)
Nothing ->
      ResultName -> ResultValue (Either Int (SamplingStats Int)) m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (Either Int (SamplingStats Int)) m)
-> ResultName -> ResultValue (Either Int (SamplingStats Int)) m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as an optimised source of statistics based on integer numbers: resultItemToIntStatsEitherValue"

-- | Return timing statistics based on integer numbers.
resultItemToIntTimingStatsValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue (TimingStats Int) m
resultItemToIntTimingStatsValue :: a m -> ResultValue (TimingStats Int) m
resultItemToIntTimingStatsValue a m
x =
  case a m -> Maybe (ResultValue (TimingStats Int) m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue a m
x of
    Just ResultValue (TimingStats Int) m
a -> ResultValue (TimingStats Int) m
a
    Maybe (ResultValue (TimingStats Int) m)
Nothing ->
      ResultName -> ResultValue (TimingStats Int) m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (TimingStats Int) m)
-> ResultName -> ResultValue (TimingStats Int) m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of timing statistics based on integer numbers: resultItemToIntTimingStatsValue"

-- | Return double numbers in time points.
resultItemToDoubleValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue Double m
resultItemToDoubleValue :: a m -> ResultValue Double m
resultItemToDoubleValue a m
x =
  case a m -> Maybe (ResultValue Double m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue a m
x of
    Just ResultValue Double m
a -> ResultValue Double m
a
    Maybe (ResultValue Double m)
Nothing ->
      ResultName -> ResultValue Double m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue Double m)
-> ResultName -> ResultValue Double m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of double-precision floating-point numbers: resultItemToDoubleValue"
  
-- | Return lists of double numbers in time points. 
resultItemToDoubleListValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue [Double] m
resultItemToDoubleListValue :: a m -> ResultValue [Double] m
resultItemToDoubleListValue a m
x =
  case a m -> Maybe (ResultValue [Double] m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue a m
x of
    Just ResultValue [Double] m
a -> ResultValue [Double] m
a
    Maybe (ResultValue [Double] m)
Nothing ->
      ResultName -> ResultValue [Double] m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue [Double] m)
-> ResultName -> ResultValue [Double] m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of lists of double-precision floating-point numbers: resultItemToDoubleListValue"

-- | Return statistics based on double numbers.
resultItemToDoubleStatsValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue (SamplingStats Double) m
resultItemToDoubleStatsValue :: a m -> ResultValue (SamplingStats Double) m
resultItemToDoubleStatsValue a m
x =
  case a m -> Maybe (ResultValue (SamplingStats Double) m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue a m
x of
    Just ResultValue (SamplingStats Double) m
a -> ResultValue (SamplingStats Double) m
a
    Maybe (ResultValue (SamplingStats Double) m)
Nothing ->
      ResultName -> ResultValue (SamplingStats Double) m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (SamplingStats Double) m)
-> ResultName -> ResultValue (SamplingStats Double) m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of statistics based on double-precision floating-point numbers: resultItemToDoubleStatsValue"

-- | Return a version optimised for fast aggregation of the statistics based on double floating point numbers.
resultItemToDoubleStatsEitherValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue (Either Double (SamplingStats Double)) m
resultItemToDoubleStatsEitherValue :: a m -> ResultValue (Either Double (SamplingStats Double)) m
resultItemToDoubleStatsEitherValue a m
x =
  case a m -> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> Maybe (ResultValue (Either Double (SamplingStats Double)) m)
resultItemAsDoubleStatsEitherValue a m
x of
    Just ResultValue (Either Double (SamplingStats Double)) m
a -> ResultValue (Either Double (SamplingStats Double)) m
a
    Maybe (ResultValue (Either Double (SamplingStats Double)) m)
Nothing ->
      ResultName -> ResultValue (Either Double (SamplingStats Double)) m
forall a. HasCallStack => ResultName -> a
error (ResultName
 -> ResultValue (Either Double (SamplingStats Double)) m)
-> ResultName
-> ResultValue (Either Double (SamplingStats Double)) m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as an optimised source of statistics based on double-precision floating-point numbers: resultItemToDoubleStatsEitherValue"

-- | Return timing statistics based on integer numbers.
resultItemToDoubleTimingStatsValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue (TimingStats Double) m
resultItemToDoubleTimingStatsValue :: a m -> ResultValue (TimingStats Double) m
resultItemToDoubleTimingStatsValue a m
x =
  case a m -> Maybe (ResultValue (TimingStats Double) m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue a m
x of
    Just ResultValue (TimingStats Double) m
a -> ResultValue (TimingStats Double) m
a
    Maybe (ResultValue (TimingStats Double) m)
Nothing ->
      ResultName -> ResultValue (TimingStats Double) m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (TimingStats Double) m)
-> ResultName -> ResultValue (TimingStats Double) m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of timing statistics based on double-precision floating-point numbers: resultItemToDoubleTimingStatsValue"

-- | Return string representations in time points.
resultItemToStringValue :: (MonadDES m, ResultItemable a) => a m -> ResultValue String m
resultItemToStringValue :: a m -> ResultValue ResultName m
resultItemToStringValue a m
x =
  case a m -> Maybe (ResultValue ResultName m)
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue a m
x of
    Just ResultValue ResultName m
a -> ResultValue ResultName m
a
    Maybe (ResultValue ResultName m)
Nothing ->
      ResultName -> ResultValue ResultName m
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue ResultName m)
-> ResultName -> ResultValue ResultName m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of strings: resultItemToStringValue"

-- | The simulation results represented by an object having properties.
data ResultObject m =
  ResultObject { ResultObject m -> ResultName
resultObjectName :: ResultName,
                 -- ^ The object name.
                 ResultObject m -> ResultId
resultObjectId :: ResultId,
                 -- ^ The object identifier.
                 ResultObject m -> ResultId
resultObjectTypeId :: ResultId,
                 -- ^ The object type identifier.
                 ResultObject m -> [ResultProperty m]
resultObjectProperties :: [ResultProperty m],
                 -- ^ The object properties.
                 ResultObject m -> ResultSignal m
resultObjectSignal :: ResultSignal m,
                 -- ^ A combined signal if present.
                 ResultObject m -> ResultSource m
resultObjectSummary :: ResultSource m
                 -- ^ A short version of the object, i.e. its summary.
               }

-- | The object property containing the simulation results.
data ResultProperty m =
  ResultProperty { ResultProperty m -> ResultName
resultPropertyLabel :: ResultName,
                   -- ^ The property short label.
                   ResultProperty m -> ResultId
resultPropertyId :: ResultId,
                   -- ^ The property identifier.
                   ResultProperty m -> ResultSource m
resultPropertySource :: ResultSource m
                   -- ^ The simulation results supplied by the property.
                 }

-- | The simulation results represented by a vector.
data ResultVector m =
  ResultVector { ResultVector m -> ResultName
resultVectorName :: ResultName,
                 -- ^ The vector name.
                 ResultVector m -> ResultId
resultVectorId :: ResultId,
                 -- ^ The vector identifier.
                 ResultVector m -> Array Int (ResultSource m)
resultVectorItems :: A.Array Int (ResultSource m),
                 -- ^ The results supplied by the vector items.
                 ResultVector m -> Array Int ResultName
resultVectorSubscript :: A.Array Int ResultName,
                 -- ^ The subscript used as a suffix to create item names.
                 ResultVector m -> ResultSignal m
resultVectorSignal :: ResultSignal m,
                 -- ^ A combined signal if present.
                 ResultVector m -> ResultSource m
resultVectorSummary :: ResultSource m
                 -- ^ A short version of the vector, i.e. summary.
               }

-- | Calculate the result vector signal and memoize it in a new vector.
memoResultVectorSignal :: MonadDES m => ResultVector m -> ResultVector m
memoResultVectorSignal :: ResultVector m -> ResultVector m
memoResultVectorSignal ResultVector m
x =
  ResultVector m
x { resultVectorSignal :: ResultSignal m
resultVectorSignal =
         (ResultSignal m -> ResultSignal m -> ResultSignal m)
-> ResultSignal m -> [ResultSignal m] -> ResultSignal m
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ResultSignal m -> ResultSignal m -> ResultSignal m
forall a. Semigroup a => a -> a -> a
(<>) ResultSignal m
forall a. Monoid a => a
mempty ([ResultSignal m] -> ResultSignal m)
-> [ResultSignal m] -> ResultSignal m
forall a b. (a -> b) -> a -> b
$ (ResultSource m -> ResultSignal m)
-> [ResultSource m] -> [ResultSignal m]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> ResultSignal m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSignal m
resultSourceSignal ([ResultSource m] -> [ResultSignal m])
-> [ResultSource m] -> [ResultSignal m]
forall a b. (a -> b) -> a -> b
$ Array Int (ResultSource m) -> [ResultSource m]
forall i e. Array i e -> [e]
A.elems (Array Int (ResultSource m) -> [ResultSource m])
-> Array Int (ResultSource m) -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
x }

-- | Calculate the result vector summary and memoize it in a new vector.
memoResultVectorSummary :: MonadDES m => ResultVector m -> ResultVector m
memoResultVectorSummary :: ResultVector m -> ResultVector m
memoResultVectorSummary ResultVector m
x =
  ResultVector m
x { resultVectorSummary :: ResultSource m
resultVectorSummary =
         ResultVector m -> ResultSource m
forall (m :: * -> *). ResultVector m -> ResultSource m
ResultVectorSource (ResultVector m -> ResultSource m)
-> ResultVector m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
         ResultVector m
x { resultVectorItems :: Array Int (ResultSource m)
resultVectorItems =
                (Int, Int) -> [(Int, ResultSource m)] -> Array Int (ResultSource m)
forall i e. Ix i => (i, i) -> [(i, e)] -> Array i e
A.array (Int, Int)
bnds [(Int
i, ResultSource m -> ResultSource m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSource m
resultSourceSummary ResultSource m
e) | (Int
i, ResultSource m
e) <- [(Int, ResultSource m)]
ies] } }
  where
    arr :: Array Int (ResultSource m)
arr  = ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
x
    bnds :: (Int, Int)
bnds = Array Int (ResultSource m) -> (Int, Int)
forall i e. Array i e -> (i, i)
A.bounds Array Int (ResultSource m)
arr
    ies :: [(Int, ResultSource m)]
ies  = Array Int (ResultSource m) -> [(Int, ResultSource m)]
forall i e. Ix i => Array i e -> [(i, e)]
A.assocs Array Int (ResultSource m)
arr

-- | It separates the simulation results when printing.
data ResultSeparator =
  ResultSeparator { ResultSeparator -> ResultName
resultSeparatorText :: String
                    -- ^ The separator text.
                  }

-- | A parameterised value that actually represents a generalised result item that have no parametric type.
data ResultValue e m =
  ResultValue { ResultValue e m -> ResultName
resultValueName :: ResultName,
                -- ^ The value name.
                ResultValue e m -> [ResultName]
resultValueNamePath :: [ResultName],
                -- ^ The value name path.
                ResultValue e m -> ResultId
resultValueId :: ResultId,
                -- ^ The value identifier.
                ResultValue e m -> [ResultId]
resultValueIdPath :: [ResultId],
                -- ^ The value identifier path.
                ResultValue e m -> ResultData e m
resultValueData :: ResultData e m,
                -- ^ Simulation data supplied by the value.
                ResultValue e m -> ResultSignal m
resultValueSignal :: ResultSignal m
                -- ^ Whether the value emits a signal when changing simulation data.
              }

-- | Map the result value according the specfied function.
mapResultValue :: MonadDES m => (a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue :: (a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue a -> b
f ResultValue a m
x = ResultValue a m
x { resultValueData :: ResultData b m
resultValueData = (a -> b) -> Event m a -> ResultData b m
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f (ResultValue a m -> Event m a
forall e (m :: * -> *). ResultValue e m -> ResultData e m
resultValueData ResultValue a m
x) }

-- | Transform the result value.
apResultValue :: MonadDES m => ResultData (a -> b) m -> ResultValue a m -> ResultValue b m
apResultValue :: ResultData (a -> b) m -> ResultValue a m -> ResultValue b m
apResultValue ResultData (a -> b) m
f ResultValue a m
x = ResultValue a m
x { resultValueData :: ResultData b m
resultValueData = ResultData (a -> b) m -> Event m a -> ResultData b m
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap ResultData (a -> b) m
f (ResultValue a m -> Event m a
forall e (m :: * -> *). ResultValue e m -> ResultData e m
resultValueData ResultValue a m
x) }

-- | A container of the simulation results such as queue, server or array.
data ResultContainer e m =
  ResultContainer { ResultContainer e m -> ResultName
resultContainerName :: ResultName,
                    -- ^ The container name.
                    ResultContainer e m -> [ResultName]
resultContainerNamePath :: [ResultName],
                    -- ^ The container name path.
                    ResultContainer e m -> ResultId
resultContainerId :: ResultId,
                    -- ^ The container identifier.
                    ResultContainer e m -> [ResultId]
resultContainerIdPath :: [ResultId],
                    -- ^ The container identifier path.
                    ResultContainer e m -> e
resultContainerData :: e,
                    -- ^ The container data.
                    ResultContainer e m -> ResultSignal m
resultContainerSignal :: ResultSignal m
                    -- ^ Whether the container emits a signal when changing simulation data.
                  }

mapResultContainer :: (a -> b) -> ResultContainer a m -> ResultContainer b m
mapResultContainer :: (a -> b) -> ResultContainer a m -> ResultContainer b m
mapResultContainer a -> b
f ResultContainer a m
x = ResultContainer a m
x { resultContainerData :: b
resultContainerData = a -> b
f (ResultContainer a m -> a
forall e (m :: * -> *). ResultContainer e m -> e
resultContainerData ResultContainer a m
x) }

-- | Create a new property source by the specified container.
resultContainerPropertySource :: ResultItemable (ResultValue b)
                                 => ResultContainer a m
                                 -- ^ the container
                                 -> ResultName
                                 -- ^ the property label
                                 -> ResultId
                                 -- ^ the property identifier
                                 -> (a -> ResultData b m)
                                 -- ^ get the specified data from the container
                                 -> (a -> ResultSignal m)
                                 -- ^ get the data signal from the container
                                 -> ResultSource m
resultContainerPropertySource :: ResultContainer a m
-> ResultName
-> ResultId
-> (a -> ResultData b m)
-> (a -> ResultSignal m)
-> ResultSource m
resultContainerPropertySource ResultContainer a m
cont ResultName
name ResultId
i a -> ResultData b m
f a -> ResultSignal m
g =
  ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m) -> ResultItem m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultValue b m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem (ResultValue b m -> ResultItem m)
-> ResultValue b m -> ResultItem m
forall a b. (a -> b) -> a -> b
$
  ResultValue :: forall e (m :: * -> *).
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultData e m
-> ResultSignal m
-> ResultValue e m
ResultValue {
    resultValueName :: ResultName
resultValueName   = (ResultContainer a m -> ResultName
forall e (m :: * -> *). ResultContainer e m -> ResultName
resultContainerName ResultContainer a m
cont) ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
"." ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
name,
    resultValueNamePath :: [ResultName]
resultValueNamePath = (ResultContainer a m -> [ResultName]
forall e (m :: * -> *). ResultContainer e m -> [ResultName]
resultContainerNamePath ResultContainer a m
cont) [ResultName] -> [ResultName] -> [ResultName]
forall a. [a] -> [a] -> [a]
++ [ResultName
name],
    resultValueId :: ResultId
resultValueId     = ResultId
i,
    resultValueIdPath :: [ResultId]
resultValueIdPath = (ResultContainer a m -> [ResultId]
forall e (m :: * -> *). ResultContainer e m -> [ResultId]
resultContainerIdPath ResultContainer a m
cont) [ResultId] -> [ResultId] -> [ResultId]
forall a. [a] -> [a] -> [a]
++ [ResultId
i],
    resultValueData :: ResultData b m
resultValueData   = a -> ResultData b m
f (ResultContainer a m -> a
forall e (m :: * -> *). ResultContainer e m -> e
resultContainerData ResultContainer a m
cont),
    resultValueSignal :: ResultSignal m
resultValueSignal = a -> ResultSignal m
g (ResultContainer a m -> a
forall e (m :: * -> *). ResultContainer e m -> e
resultContainerData ResultContainer a m
cont) }

-- | Create a constant property by the specified container.
resultContainerConstProperty :: (MonadDES m,
                                 ResultItemable (ResultValue b))
                                => ResultContainer a m
                                -- ^ the container
                                -> ResultName
                                -- ^ the property label
                                -> ResultId
                                -- ^ the property identifier
                                -> (a -> b)
                                -- ^ get the specified data from the container
                                -> ResultProperty m
resultContainerConstProperty :: ResultContainer a m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerConstProperty ResultContainer a m
cont ResultName
name ResultId
i a -> b
f =
  ResultProperty :: forall (m :: * -> *).
ResultName -> ResultId -> ResultSource m -> ResultProperty m
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource m
resultPropertySource =
      ResultContainer a m
-> ResultName
-> ResultId
-> (a -> ResultData b m)
-> (a -> ResultSignal m)
-> ResultSource m
forall b a (m :: * -> *).
ResultItemable (ResultValue b) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> ResultData b m)
-> (a -> ResultSignal m)
-> ResultSource m
resultContainerPropertySource ResultContainer a m
cont ResultName
name ResultId
i (b -> ResultData b m
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> ResultData b m) -> (a -> b) -> a -> ResultData b m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f) (ResultSignal m -> a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
EmptyResultSignal) }
  
-- | Create by the specified container a property that changes in the integration time points, or it is supposed to be such one.
resultContainerIntegProperty :: (MonadDES m,
                                 ResultItemable (ResultValue b))
                                => ResultContainer a m
                                -- ^ the container
                                -> ResultName
                                -- ^ the property label
                                -> ResultId
                                -- ^ the property identifier
                                -> (a -> Event m b)
                                -- ^ get the specified data from the container
                                -> ResultProperty m
resultContainerIntegProperty :: ResultContainer a m
-> ResultName -> ResultId -> (a -> Event m b) -> ResultProperty m
resultContainerIntegProperty ResultContainer a m
cont ResultName
name ResultId
i a -> Event m b
f =
  ResultProperty :: forall (m :: * -> *).
ResultName -> ResultId -> ResultSource m -> ResultProperty m
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource m
resultPropertySource =
      ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> ResultSignal m)
-> ResultSource m
forall b a (m :: * -> *).
ResultItemable (ResultValue b) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> ResultData b m)
-> (a -> ResultSignal m)
-> ResultSource m
resultContainerPropertySource ResultContainer a m
cont ResultName
name ResultId
i a -> Event m b
f (ResultSignal m -> a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal) }
  
-- | Create a property by the specified container.
resultContainerProperty :: (MonadDES m,
                            ResultItemable (ResultValue b))
                           => ResultContainer a m
                           -- ^ the container
                           -> ResultName
                           -- ^ the property label
                           -> ResultId
                           -- ^ the property identifier
                           -> (a -> Event m b)
                           -- ^ get the specified data from the container
                           -> (a -> Signal m ())
                           -- ^ get a signal triggered when changing data.
                           -> ResultProperty m
resultContainerProperty :: ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer a m
cont ResultName
name ResultId
i a -> Event m b
f a -> Signal m ()
g =                     
  ResultProperty :: forall (m :: * -> *).
ResultName -> ResultId -> ResultSource m -> ResultProperty m
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource m
resultPropertySource =
      ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> ResultSignal m)
-> ResultSource m
forall b a (m :: * -> *).
ResultItemable (ResultValue b) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> ResultData b m)
-> (a -> ResultSignal m)
-> ResultSource m
resultContainerPropertySource ResultContainer a m
cont ResultName
name ResultId
i a -> Event m b
f (Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignal (Signal m () -> ResultSignal m)
-> (a -> Signal m ()) -> a -> ResultSignal m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Signal m ()
g) }

-- | Create by the specified container a mapped property which is recomputed each time again and again.
resultContainerMapProperty :: (MonadDES m,
                               ResultItemable (ResultValue b))
                              => ResultContainer (ResultData a m) m
                              -- ^ the container
                              -> ResultName
                              -- ^ the property label
                              -> ResultId
                              -- ^ the property identifier
                              -> (a -> b)
                              -- ^ recompute the specified data
                              -> ResultProperty m
resultContainerMapProperty :: ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData a m) m
cont ResultName
name ResultId
i a -> b
f =                     
  ResultProperty :: forall (m :: * -> *).
ResultName -> ResultId -> ResultSource m -> ResultProperty m
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource m
resultPropertySource =
      ResultContainer (ResultData a m) m
-> ResultName
-> ResultId
-> (ResultData a m -> ResultData b m)
-> (ResultData a m -> ResultSignal m)
-> ResultSource m
forall b a (m :: * -> *).
ResultItemable (ResultValue b) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> ResultData b m)
-> (a -> ResultSignal m)
-> ResultSource m
resultContainerPropertySource ResultContainer (ResultData a m) m
cont ResultName
name ResultId
i ((a -> b) -> ResultData a m -> ResultData b m
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) (ResultSignal m -> ResultData a m -> ResultSignal m
forall a b. a -> b -> a
const (ResultSignal m -> ResultData a m -> ResultSignal m)
-> ResultSignal m -> ResultData a m -> ResultSignal m
forall a b. (a -> b) -> a -> b
$ ResultContainer (ResultData a m) m -> ResultSignal m
forall e (m :: * -> *). ResultContainer e m -> ResultSignal m
resultContainerSignal ResultContainer (ResultData a m) m
cont) }

-- | Convert the result value to a container with the specified object identifier. 
resultValueToContainer :: ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer :: ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue a m
x =
  ResultContainer :: forall e (m :: * -> *).
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal m
-> ResultContainer e m
ResultContainer {
    resultContainerName :: ResultName
resultContainerName   = ResultValue a m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue a m
x,
    resultContainerNamePath :: [ResultName]
resultContainerNamePath = ResultValue a m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath ResultValue a m
x,
    resultContainerId :: ResultId
resultContainerId     = ResultValue a m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue a m
x,
    resultContainerIdPath :: [ResultId]
resultContainerIdPath = ResultValue a m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath ResultValue a m
x,
    resultContainerData :: ResultData a m
resultContainerData   = ResultValue a m -> ResultData a m
forall e (m :: * -> *). ResultValue e m -> ResultData e m
resultValueData ResultValue a m
x,
    resultContainerSignal :: ResultSignal m
resultContainerSignal = ResultValue a m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue a m
x }

-- | Convert the result container to a value.
resultContainerToValue :: ResultContainer (ResultData a m) m -> ResultValue a m
resultContainerToValue :: ResultContainer (ResultData a m) m -> ResultValue a m
resultContainerToValue ResultContainer (ResultData a m) m
x =
  ResultValue :: forall e (m :: * -> *).
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultData e m
-> ResultSignal m
-> ResultValue e m
ResultValue {
    resultValueName :: ResultName
resultValueName   = ResultContainer (ResultData a m) m -> ResultName
forall e (m :: * -> *). ResultContainer e m -> ResultName
resultContainerName ResultContainer (ResultData a m) m
x,
    resultValueNamePath :: [ResultName]
resultValueNamePath = ResultContainer (ResultData a m) m -> [ResultName]
forall e (m :: * -> *). ResultContainer e m -> [ResultName]
resultContainerNamePath ResultContainer (ResultData a m) m
x,
    resultValueId :: ResultId
resultValueId     = ResultContainer (ResultData a m) m -> ResultId
forall e (m :: * -> *). ResultContainer e m -> ResultId
resultContainerId ResultContainer (ResultData a m) m
x,
    resultValueIdPath :: [ResultId]
resultValueIdPath = ResultContainer (ResultData a m) m -> [ResultId]
forall e (m :: * -> *). ResultContainer e m -> [ResultId]
resultContainerIdPath ResultContainer (ResultData a m) m
x,
    resultValueData :: ResultData a m
resultValueData   = ResultContainer (ResultData a m) m -> ResultData a m
forall e (m :: * -> *). ResultContainer e m -> e
resultContainerData ResultContainer (ResultData a m) m
x,
    resultValueSignal :: ResultSignal m
resultValueSignal = ResultContainer (ResultData a m) m -> ResultSignal m
forall e (m :: * -> *). ResultContainer e m -> ResultSignal m
resultContainerSignal ResultContainer (ResultData a m) m
x }

-- | Represents the very simulation results.
type ResultData e m = Event m e

-- | Convert the timing statistics data to its normalised sampling-based representation.
normTimingStatsData :: (TimingData a, Monad m) => ResultData (TimingStats a -> SamplingStats a) m
normTimingStatsData :: ResultData (TimingStats a -> SamplingStats a) m
normTimingStatsData =
  do Int
n <- Dynamics m Int -> Event m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics Dynamics m Int
forall (m :: * -> *). Monad m => Dynamics m Int
integIteration
     (TimingStats a -> SamplingStats a)
-> ResultData (TimingStats a -> SamplingStats a) m
forall (m :: * -> *) a. Monad m => a -> m a
return ((TimingStats a -> SamplingStats a)
 -> ResultData (TimingStats a -> SamplingStats a) m)
-> (TimingStats a -> SamplingStats a)
-> ResultData (TimingStats a -> SamplingStats a) m
forall a b. (a -> b) -> a -> b
$ Int -> TimingStats a -> SamplingStats a
forall a. TimingData a => Int -> TimingStats a -> SamplingStats a
normTimingStats (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)

-- | Whether an object containing the results emits a signal notifying about change of data.
data ResultSignal m = EmptyResultSignal
                      -- ^ There is no signal at all.
                    | UnknownResultSignal
                      -- ^ The signal is unknown, but the entity probably changes.
                    | ResultSignal (Signal m ())
                      -- ^ When the signal is precisely specified.
                    | ResultSignalMix (Signal m ())
                      -- ^ When the specified signal was combined with unknown signal.

instance MonadDES m => Semigroup (ResultSignal m) where

  <> :: ResultSignal m -> ResultSignal m -> ResultSignal m
(<>) ResultSignal m
EmptyResultSignal ResultSignal m
z = ResultSignal m
z

  (<>) ResultSignal m
UnknownResultSignal ResultSignal m
EmptyResultSignal = ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal
  (<>) ResultSignal m
UnknownResultSignal ResultSignal m
UnknownResultSignal = ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal
  (<>) ResultSignal m
UnknownResultSignal (ResultSignal Signal m ()
x) = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignalMix Signal m ()
x
  (<>) ResultSignal m
UnknownResultSignal z :: ResultSignal m
z@(ResultSignalMix Signal m ()
x) = ResultSignal m
z

  (<>) z :: ResultSignal m
z@(ResultSignal Signal m ()
x) ResultSignal m
EmptyResultSignal = ResultSignal m
z
  (<>) (ResultSignal Signal m ()
x) ResultSignal m
UnknownResultSignal = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignalMix Signal m ()
x
  (<>) (ResultSignal Signal m ()
x) (ResultSignal Signal m ()
y) = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignal (Signal m ()
x Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m ()
y)
  (<>) (ResultSignal Signal m ()
x) (ResultSignalMix Signal m ()
y) = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignalMix (Signal m ()
x Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m ()
y)

  (<>) z :: ResultSignal m
z@(ResultSignalMix Signal m ()
x) ResultSignal m
EmptyResultSignal = ResultSignal m
z
  (<>) z :: ResultSignal m
z@(ResultSignalMix Signal m ()
x) ResultSignal m
UnknownResultSignal = ResultSignal m
z
  (<>) (ResultSignalMix Signal m ()
x) (ResultSignal Signal m ()
y) = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignalMix (Signal m ()
x Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m ()
y)
  (<>) (ResultSignalMix Signal m ()
x) (ResultSignalMix Signal m ()
y) = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignalMix (Signal m ()
x Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m ()
y)

instance MonadDES m => Monoid (ResultSignal m) where

  mempty :: ResultSignal m
mempty = ResultSignal m
forall (m :: * -> *). ResultSignal m
EmptyResultSignal

  mappend :: ResultSignal m -> ResultSignal m -> ResultSignal m
mappend = ResultSignal m -> ResultSignal m -> ResultSignal m
forall a. Semigroup a => a -> a -> a
(<>)

-- | Construct a new result signal by the specified optional pure signal.
maybeResultSignal :: Maybe (Signal m ()) -> ResultSignal m
maybeResultSignal :: Maybe (Signal m ()) -> ResultSignal m
maybeResultSignal (Just Signal m ()
x) = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignal Signal m ()
x
maybeResultSignal Maybe (Signal m ())
Nothing  = ResultSignal m
forall (m :: * -> *). ResultSignal m
EmptyResultSignal

instance ResultItemable (ResultValue Int) where

  resultItemName :: ResultValue Int m -> ResultName
resultItemName = ResultValue Int m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue Int m -> [ResultName]
resultItemNamePath = ResultValue Int m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue Int m -> ResultId
resultItemId = ResultValue Int m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue Int m -> [ResultId]
resultItemIdPath = ResultValue Int m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue Int m -> ResultSignal m
resultItemSignal = ResultValue Int m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue Int m -> Maybe (ResultValue Int m)
resultItemAsIntValue = ResultValue Int m -> Maybe (ResultValue Int m)
forall a. a -> Maybe a
Just
  resultItemAsIntListValue :: ResultValue Int m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = ResultValue [Int] m -> Maybe (ResultValue [Int] m)
forall a. a -> Maybe a
Just (ResultValue [Int] m -> Maybe (ResultValue [Int] m))
-> (ResultValue Int m -> ResultValue [Int] m)
-> ResultValue Int m
-> Maybe (ResultValue [Int] m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> [Int]) -> ResultValue Int m -> ResultValue [Int] m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Int -> [Int]
forall (m :: * -> *) a. Monad m => a -> m a
return
  resultItemAsIntStatsValue :: ResultValue Int m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Int) m
 -> Maybe (ResultValue (SamplingStats Int) m))
-> (ResultValue Int m -> ResultValue (SamplingStats Int) m)
-> ResultValue Int m
-> Maybe (ResultValue (SamplingStats Int) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> SamplingStats Int)
-> ResultValue Int m -> ResultValue (SamplingStats Int) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Int -> SamplingStats Int
forall a. SamplingData a => a -> SamplingStats a
returnSamplingStats
  resultItemAsIntTimingStatsValue :: ResultValue Int m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue Int m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue Int m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = ResultValue Double m -> Maybe (ResultValue Double m)
forall a. a -> Maybe a
Just (ResultValue Double m -> Maybe (ResultValue Double m))
-> (ResultValue Int m -> ResultValue Double m)
-> ResultValue Int m
-> Maybe (ResultValue Double m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Double) -> ResultValue Int m -> ResultValue Double m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  resultItemAsDoubleListValue :: ResultValue Int m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = ResultValue [Double] m -> Maybe (ResultValue [Double] m)
forall a. a -> Maybe a
Just (ResultValue [Double] m -> Maybe (ResultValue [Double] m))
-> (ResultValue Int m -> ResultValue [Double] m)
-> ResultValue Int m
-> Maybe (ResultValue [Double] m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> [Double]) -> ResultValue Int m -> ResultValue [Double] m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue (Double -> [Double]
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> [Double]) -> (Int -> Double) -> Int -> [Double]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
  resultItemAsDoubleStatsValue :: ResultValue Int m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue Int m -> ResultValue (SamplingStats Double) m)
-> ResultValue Int m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> SamplingStats Double)
-> ResultValue Int m -> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue (Double -> SamplingStats Double
forall a. SamplingData a => a -> SamplingStats a
returnSamplingStats (Double -> SamplingStats Double)
-> (Int -> Double) -> Int -> SamplingStats Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
  resultItemAsDoubleTimingStatsValue :: ResultValue Int m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue Int m -> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue Int m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue Int m -> ResultValue ResultName m)
-> ResultValue Int m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> ResultName)
-> ResultValue Int m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Int -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue Int m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue Int m -> ResultItem m)
-> ResultValue Int m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue Int m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue Int m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue Int m -> ResultItem m)
-> ResultValue Int m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue Int m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue Double) where

  resultItemName :: ResultValue Double m -> ResultName
resultItemName = ResultValue Double m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue Double m -> [ResultName]
resultItemNamePath = ResultValue Double m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue Double m -> ResultId
resultItemId = ResultValue Double m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue Double m -> [ResultId]
resultItemIdPath = ResultValue Double m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue Double m -> ResultSignal m
resultItemSignal = ResultValue Double m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue Double m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue Double m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue Double m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue Double m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue Double m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue Double m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue Double m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue Double m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing
  
  resultItemAsDoubleValue :: ResultValue Double m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = ResultValue Double m -> Maybe (ResultValue Double m)
forall a. a -> Maybe a
Just
  resultItemAsDoubleListValue :: ResultValue Double m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = ResultValue [Double] m -> Maybe (ResultValue [Double] m)
forall a. a -> Maybe a
Just (ResultValue [Double] m -> Maybe (ResultValue [Double] m))
-> (ResultValue Double m -> ResultValue [Double] m)
-> ResultValue Double m
-> Maybe (ResultValue [Double] m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> [Double])
-> ResultValue Double m -> ResultValue [Double] m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Double -> [Double]
forall (m :: * -> *) a. Monad m => a -> m a
return
  resultItemAsDoubleStatsValue :: ResultValue Double m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue Double m -> ResultValue (SamplingStats Double) m)
-> ResultValue Double m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> SamplingStats Double)
-> ResultValue Double m -> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Double -> SamplingStats Double
forall a. SamplingData a => a -> SamplingStats a
returnSamplingStats
  resultItemAsDoubleTimingStatsValue :: ResultValue Double m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue Double m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue Double m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue Double m -> ResultValue ResultName m)
-> ResultValue Double m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> ResultName)
-> ResultValue Double m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Double -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue Double m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue Double m -> ResultItem m)
-> ResultValue Double m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue Double m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue Double m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue Double m -> ResultItem m)
-> ResultValue Double m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue Double m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue [Int]) where

  resultItemName :: ResultValue [Int] m -> ResultName
resultItemName = ResultValue [Int] m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue [Int] m -> [ResultName]
resultItemNamePath = ResultValue [Int] m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue [Int] m -> ResultId
resultItemId = ResultValue [Int] m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue [Int] m -> [ResultId]
resultItemIdPath = ResultValue [Int] m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue [Int] m -> ResultSignal m
resultItemSignal = ResultValue [Int] m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue [Int] m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue [Int] m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue [Int] m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = ResultValue [Int] m -> Maybe (ResultValue [Int] m)
forall a. a -> Maybe a
Just
  resultItemAsIntStatsValue :: ResultValue [Int] m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Int) m
 -> Maybe (ResultValue (SamplingStats Int) m))
-> (ResultValue [Int] m -> ResultValue (SamplingStats Int) m)
-> ResultValue [Int] m
-> Maybe (ResultValue (SamplingStats Int) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int] -> SamplingStats Int)
-> ResultValue [Int] m -> ResultValue (SamplingStats Int) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue [Int] -> SamplingStats Int
forall a. SamplingData a => [a] -> SamplingStats a
listSamplingStats
  resultItemAsIntTimingStatsValue :: ResultValue [Int] m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue [Int] m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue [Int] m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue [Int] m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue [Int] m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = ResultValue [Double] m -> Maybe (ResultValue [Double] m)
forall a. a -> Maybe a
Just (ResultValue [Double] m -> Maybe (ResultValue [Double] m))
-> (ResultValue [Int] m -> ResultValue [Double] m)
-> ResultValue [Int] m
-> Maybe (ResultValue [Double] m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int] -> [Double])
-> ResultValue [Int] m -> ResultValue [Double] m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue ((Int -> Double) -> [Int] -> [Double]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
  resultItemAsDoubleStatsValue :: ResultValue [Int] m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue [Int] m -> ResultValue (SamplingStats Double) m)
-> ResultValue [Int] m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int] -> SamplingStats Double)
-> ResultValue [Int] m -> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue (SamplingStats Int -> SamplingStats Double
fromIntSamplingStats (SamplingStats Int -> SamplingStats Double)
-> ([Int] -> SamplingStats Int) -> [Int] -> SamplingStats Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Int] -> SamplingStats Int
forall a. SamplingData a => [a] -> SamplingStats a
listSamplingStats)
  resultItemAsDoubleTimingStatsValue :: ResultValue [Int] m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue [Int] m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue [Int] m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue [Int] m -> ResultValue ResultName m)
-> ResultValue [Int] m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int] -> ResultName)
-> ResultValue [Int] m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue [Int] -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue [Int] m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue [Int] m -> ResultItem m)
-> ResultValue [Int] m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue [Int] m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue [Int] m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue [Int] m -> ResultItem m)
-> ResultValue [Int] m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue [Int] m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue [Double]) where

  resultItemName :: ResultValue [Double] m -> ResultName
resultItemName = ResultValue [Double] m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue [Double] m -> [ResultName]
resultItemNamePath = ResultValue [Double] m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue [Double] m -> ResultId
resultItemId = ResultValue [Double] m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue [Double] m -> [ResultId]
resultItemIdPath = ResultValue [Double] m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue [Double] m -> ResultSignal m
resultItemSignal = ResultValue [Double] m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue [Double] m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue [Double] m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue [Double] m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue [Double] m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue [Double] m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue [Double] m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue [Double] m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue [Double] m
-> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing
  
  resultItemAsDoubleValue :: ResultValue [Double] m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue [Double] m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue [Double] m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = ResultValue [Double] m -> Maybe (ResultValue [Double] m)
forall a. a -> Maybe a
Just
  resultItemAsDoubleStatsValue :: ResultValue [Double] m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue [Double] m -> ResultValue (SamplingStats Double) m)
-> ResultValue [Double] m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Double] -> SamplingStats Double)
-> ResultValue [Double] m -> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue [Double] -> SamplingStats Double
forall a. SamplingData a => [a] -> SamplingStats a
listSamplingStats
  resultItemAsDoubleTimingStatsValue :: ResultValue [Double] m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue [Double] m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue [Double] m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue [Double] m -> ResultValue ResultName m)
-> ResultValue [Double] m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Double] -> ResultName)
-> ResultValue [Double] m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue [Double] -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue [Double] m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue [Double] m -> ResultItem m)
-> ResultValue [Double] m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue [Double] m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue [Double] m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue [Double] m -> ResultItem m)
-> ResultValue [Double] m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue [Double] m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue (SamplingStats Int)) where

  resultItemName :: ResultValue (SamplingStats Int) m -> ResultName
resultItemName = ResultValue (SamplingStats Int) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (SamplingStats Int) m -> [ResultName]
resultItemNamePath = ResultValue (SamplingStats Int) m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (SamplingStats Int) m -> ResultId
resultItemId = ResultValue (SamplingStats Int) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (SamplingStats Int) m -> [ResultId]
resultItemIdPath = ResultValue (SamplingStats Int) m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (SamplingStats Int) m -> ResultSignal m
resultItemSignal = ResultValue (SamplingStats Int) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (SamplingStats Int) m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue (SamplingStats Int) m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (SamplingStats Int) m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue (SamplingStats Int) m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a. a -> Maybe a
Just
  resultItemAsIntTimingStatsValue :: ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue (SamplingStats Int) m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue (SamplingStats Int) m
-> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (SamplingStats Int) m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue (SamplingStats Int) m
-> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue (SamplingStats Int) m
    -> ResultValue (SamplingStats Double) m)
-> ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SamplingStats Int -> SamplingStats Double)
-> ResultValue (SamplingStats Int) m
-> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SamplingStats Int -> SamplingStats Double
fromIntSamplingStats
  resultItemAsDoubleTimingStatsValue :: ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue (SamplingStats Int) m
-> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue (SamplingStats Int) m -> ResultValue ResultName m)
-> ResultValue (SamplingStats Int) m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SamplingStats Int -> ResultName)
-> ResultValue (SamplingStats Int) m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SamplingStats Int -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (SamplingStats Int) m -> ResultSource m
resultItemExpansion = ResultValue (SamplingStats Int) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSource
  resultItemSummary :: ResultValue (SamplingStats Int) m -> ResultSource m
resultItemSummary = ResultValue (SamplingStats Int) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSummary

instance ResultItemable (ResultValue (SamplingStats Double)) where

  resultItemName :: ResultValue (SamplingStats Double) m -> ResultName
resultItemName = ResultValue (SamplingStats Double) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (SamplingStats Double) m -> [ResultName]
resultItemNamePath = ResultValue (SamplingStats Double) m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (SamplingStats Double) m -> ResultId
resultItemId = ResultValue (SamplingStats Double) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (SamplingStats Double) m -> [ResultId]
resultItemIdPath = ResultValue (SamplingStats Double) m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (SamplingStats Double) m -> ResultSignal m
resultItemSignal = ResultValue (SamplingStats Double) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (SamplingStats Double) m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (SamplingStats Double) m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing
  
  resultItemAsDoubleValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just
  resultItemAsDoubleTimingStatsValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue (SamplingStats Double) m
-> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue (SamplingStats Double) m
    -> ResultValue ResultName m)
-> ResultValue (SamplingStats Double) m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SamplingStats Double -> ResultName)
-> ResultValue (SamplingStats Double) m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SamplingStats Double -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (SamplingStats Double) m -> ResultSource m
resultItemExpansion = ResultValue (SamplingStats Double) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSource
  resultItemSummary :: ResultValue (SamplingStats Double) m -> ResultSource m
resultItemSummary = ResultValue (SamplingStats Double) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSummary

instance ResultItemable (ResultValue (TimingStats Int)) where

  resultItemName :: ResultValue (TimingStats Int) m -> ResultName
resultItemName = ResultValue (TimingStats Int) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (TimingStats Int) m -> [ResultName]
resultItemNamePath = ResultValue (TimingStats Int) m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (TimingStats Int) m -> ResultId
resultItemId = ResultValue (TimingStats Int) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (TimingStats Int) m -> [ResultId]
resultItemIdPath = ResultValue (TimingStats Int) m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (TimingStats Int) m -> ResultSignal m
resultItemSignal = ResultValue (TimingStats Int) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (TimingStats Int) m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue (TimingStats Int) m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (TimingStats Int) m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue (TimingStats Int) m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (TimingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = ResultValue (SamplingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Int) m
 -> Maybe (ResultValue (SamplingStats Int) m))
-> (ResultValue (TimingStats Int) m
    -> ResultValue (SamplingStats Int) m)
-> ResultValue (TimingStats Int) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultData (TimingStats Int -> SamplingStats Int) m
-> ResultValue (TimingStats Int) m
-> ResultValue (SamplingStats Int) m
forall (m :: * -> *) a b.
MonadDES m =>
ResultData (a -> b) m -> ResultValue a m -> ResultValue b m
apResultValue ResultData (TimingStats Int -> SamplingStats Int) m
forall a (m :: * -> *).
(TimingData a, Monad m) =>
ResultData (TimingStats a -> SamplingStats a) m
normTimingStatsData
  resultItemAsIntTimingStatsValue :: ResultValue (TimingStats Int) m
-> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = ResultValue (TimingStats Int) m
-> Maybe (ResultValue (TimingStats Int) m)
forall a. a -> Maybe a
Just

  resultItemAsDoubleValue :: ResultValue (TimingStats Int) m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue (TimingStats Int) m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (TimingStats Int) m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue (TimingStats Int) m
-> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (TimingStats Int) m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue (TimingStats Int) m
    -> ResultValue (SamplingStats Double) m)
-> ResultValue (TimingStats Int) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SamplingStats Int -> SamplingStats Double)
-> ResultValue (SamplingStats Int) m
-> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SamplingStats Int -> SamplingStats Double
fromIntSamplingStats (ResultValue (SamplingStats Int) m
 -> ResultValue (SamplingStats Double) m)
-> (ResultValue (TimingStats Int) m
    -> ResultValue (SamplingStats Int) m)
-> ResultValue (TimingStats Int) m
-> ResultValue (SamplingStats Double) m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultData (TimingStats Int -> SamplingStats Int) m
-> ResultValue (TimingStats Int) m
-> ResultValue (SamplingStats Int) m
forall (m :: * -> *) a b.
MonadDES m =>
ResultData (a -> b) m -> ResultValue a m -> ResultValue b m
apResultValue ResultData (TimingStats Int -> SamplingStats Int) m
forall a (m :: * -> *).
(TimingData a, Monad m) =>
ResultData (TimingStats a -> SamplingStats a) m
normTimingStatsData
  resultItemAsDoubleTimingStatsValue :: ResultValue (TimingStats Int) m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = ResultValue (TimingStats Double) m
-> Maybe (ResultValue (TimingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (TimingStats Double) m
 -> Maybe (ResultValue (TimingStats Double) m))
-> (ResultValue (TimingStats Int) m
    -> ResultValue (TimingStats Double) m)
-> ResultValue (TimingStats Int) m
-> Maybe (ResultValue (TimingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TimingStats Int -> TimingStats Double)
-> ResultValue (TimingStats Int) m
-> ResultValue (TimingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue TimingStats Int -> TimingStats Double
fromIntTimingStats

  resultItemAsStringValue :: ResultValue (TimingStats Int) m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue (TimingStats Int) m -> ResultValue ResultName m)
-> ResultValue (TimingStats Int) m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TimingStats Int -> ResultName)
-> ResultValue (TimingStats Int) m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue TimingStats Int -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (TimingStats Int) m -> ResultSource m
resultItemExpansion = ResultValue (TimingStats Int) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, TimingData a, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSource
  resultItemSummary :: ResultValue (TimingStats Int) m -> ResultSource m
resultItemSummary = ResultValue (TimingStats Int) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, TimingData a,
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSummary

instance ResultItemable (ResultValue  (TimingStats Double)) where

  resultItemName :: ResultValue (TimingStats Double) m -> ResultName
resultItemName = ResultValue (TimingStats Double) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (TimingStats Double) m -> [ResultName]
resultItemNamePath = ResultValue (TimingStats Double) m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (TimingStats Double) m -> ResultId
resultItemId = ResultValue (TimingStats Double) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (TimingStats Double) m -> [ResultId]
resultItemIdPath = ResultValue (TimingStats Double) m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (TimingStats Double) m -> ResultSignal m
resultItemSignal = ResultValue (TimingStats Double) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (TimingStats Double) m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue (TimingStats Double) m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (TimingStats Double) m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (TimingStats Double) m
-> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue (TimingStats Double) m
-> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue (TimingStats Double) m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (TimingStats Double) m
-> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (TimingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double) m
 -> Maybe (ResultValue (SamplingStats Double) m))
-> (ResultValue (TimingStats Double) m
    -> ResultValue (SamplingStats Double) m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue (SamplingStats Double) m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultData (TimingStats Double -> SamplingStats Double) m
-> ResultValue (TimingStats Double) m
-> ResultValue (SamplingStats Double) m
forall (m :: * -> *) a b.
MonadDES m =>
ResultData (a -> b) m -> ResultValue a m -> ResultValue b m
apResultValue ResultData (TimingStats Double -> SamplingStats Double) m
forall a (m :: * -> *).
(TimingData a, Monad m) =>
ResultData (TimingStats a -> SamplingStats a) m
normTimingStatsData
  resultItemAsDoubleTimingStatsValue :: ResultValue (TimingStats Double) m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = ResultValue (TimingStats Double) m
-> Maybe (ResultValue (TimingStats Double) m)
forall a. a -> Maybe a
Just

  resultItemAsStringValue :: ResultValue (TimingStats Double) m
-> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue (TimingStats Double) m -> ResultValue ResultName m)
-> ResultValue (TimingStats Double) m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TimingStats Double -> ResultName)
-> ResultValue (TimingStats Double) m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue TimingStats Double -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (TimingStats Double) m -> ResultSource m
resultItemExpansion = ResultValue (TimingStats Double) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, TimingData a, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSource
  resultItemSummary :: ResultValue (TimingStats Double) m -> ResultSource m
resultItemSummary = ResultValue (TimingStats Double) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, TimingData a,
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSummary

instance ResultItemable (ResultValue Bool) where

  resultItemName :: ResultValue Bool m -> ResultName
resultItemName = ResultValue Bool m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue Bool m -> [ResultName]
resultItemNamePath = ResultValue Bool m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue Bool m -> ResultId
resultItemId = ResultValue Bool m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue Bool m -> [ResultId]
resultItemIdPath = ResultValue Bool m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue Bool m -> ResultSignal m
resultItemSignal = ResultValue Bool m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue Bool m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue Bool m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue Bool m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue Bool m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue Bool m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue Bool m -> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue Bool m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue Bool m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue Bool m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue Bool m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue Bool m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue Bool m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue Bool m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue Bool m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue Bool m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue Bool m -> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue Bool m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue Bool m -> ResultValue ResultName m)
-> ResultValue Bool m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Bool -> ResultName)
-> ResultValue Bool m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue Bool -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue Bool m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue Bool m -> ResultItem m)
-> ResultValue Bool m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue Bool m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue Bool m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue Bool m -> ResultItem m)
-> ResultValue Bool m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue Bool m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue String) where

  resultItemName :: ResultValue ResultName m -> ResultName
resultItemName = ResultValue ResultName m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue ResultName m -> [ResultName]
resultItemNamePath = ResultValue ResultName m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue ResultName m -> ResultId
resultItemId = ResultValue ResultName m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue ResultName m -> [ResultId]
resultItemIdPath = ResultValue ResultName m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue ResultName m -> ResultSignal m
resultItemSignal = ResultValue ResultName m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue ResultName m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue ResultName m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue ResultName m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue ResultName m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue ResultName m
-> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue ResultName m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue ResultName m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue ResultName m
-> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue ResultName m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue ResultName m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue ResultName m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue ResultName m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue ResultName m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue ResultName m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue ResultName m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue ResultName m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue ResultName m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just

  resultItemExpansion :: ResultValue ResultName m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue ResultName m -> ResultItem m)
-> ResultValue ResultName m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue ResultName m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue ResultName m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue ResultName m -> ResultItem m)
-> ResultValue ResultName m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue ResultName m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue ()) where

  resultItemName :: ResultValue () m -> ResultName
resultItemName = ResultValue () m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue () m -> [ResultName]
resultItemNamePath = ResultValue () m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue () m -> ResultId
resultItemId = ResultValue () m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue () m -> [ResultId]
resultItemIdPath = ResultValue () m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue () m -> ResultSignal m
resultItemSignal = ResultValue () m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue () m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue () m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue () m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue () m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue () m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue () m -> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue () m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue () m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue () m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue () m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue () m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue () m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue () m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue () m -> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue () m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue () m -> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue () m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue () m -> ResultValue ResultName m)
-> ResultValue () m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (() -> ResultName) -> ResultValue () m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue () -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue () m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue () m -> ResultItem m)
-> ResultValue () m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue () m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue () m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue () m -> ResultItem m)
-> ResultValue () m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue () m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue FCFS) where

  resultItemName :: ResultValue FCFS m -> ResultName
resultItemName = ResultValue FCFS m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue FCFS m -> [ResultName]
resultItemNamePath = ResultValue FCFS m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue FCFS m -> ResultId
resultItemId = ResultValue FCFS m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue FCFS m -> [ResultId]
resultItemIdPath = ResultValue FCFS m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue FCFS m -> ResultSignal m
resultItemSignal = ResultValue FCFS m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue FCFS m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue FCFS m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue FCFS m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue FCFS m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue FCFS m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue FCFS m -> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue FCFS m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue FCFS m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue FCFS m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue FCFS m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue FCFS m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue FCFS m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue FCFS m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue FCFS m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue FCFS m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue FCFS m -> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue FCFS m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue FCFS m -> ResultValue ResultName m)
-> ResultValue FCFS m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FCFS -> ResultName)
-> ResultValue FCFS m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue FCFS -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue FCFS m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue FCFS m -> ResultItem m)
-> ResultValue FCFS m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue FCFS m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue FCFS m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue FCFS m -> ResultItem m)
-> ResultValue FCFS m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue FCFS m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue LCFS) where

  resultItemName :: ResultValue LCFS m -> ResultName
resultItemName = ResultValue LCFS m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue LCFS m -> [ResultName]
resultItemNamePath = ResultValue LCFS m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue LCFS m -> ResultId
resultItemId = ResultValue LCFS m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue LCFS m -> [ResultId]
resultItemIdPath = ResultValue LCFS m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue LCFS m -> ResultSignal m
resultItemSignal = ResultValue LCFS m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue LCFS m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue LCFS m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue LCFS m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue LCFS m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue LCFS m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue LCFS m -> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue LCFS m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue LCFS m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue LCFS m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue LCFS m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue LCFS m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue LCFS m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue LCFS m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue LCFS m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue LCFS m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue LCFS m -> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue LCFS m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue LCFS m -> ResultValue ResultName m)
-> ResultValue LCFS m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LCFS -> ResultName)
-> ResultValue LCFS m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue LCFS -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue LCFS m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue LCFS m -> ResultItem m)
-> ResultValue LCFS m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue LCFS m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue LCFS m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue LCFS m -> ResultItem m)
-> ResultValue LCFS m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue LCFS m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue SIRO) where

  resultItemName :: ResultValue SIRO m -> ResultName
resultItemName = ResultValue SIRO m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue SIRO m -> [ResultName]
resultItemNamePath = ResultValue SIRO m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue SIRO m -> ResultId
resultItemId = ResultValue SIRO m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue SIRO m -> [ResultId]
resultItemIdPath = ResultValue SIRO m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue SIRO m -> ResultSignal m
resultItemSignal = ResultValue SIRO m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue SIRO m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue SIRO m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue SIRO m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue SIRO m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue SIRO m -> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue SIRO m -> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue SIRO m -> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue SIRO m -> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue SIRO m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue SIRO m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue SIRO m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue SIRO m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue SIRO m -> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue SIRO m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue SIRO m -> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue SIRO m -> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue SIRO m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue SIRO m -> ResultValue ResultName m)
-> ResultValue SIRO m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SIRO -> ResultName)
-> ResultValue SIRO m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue SIRO -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue SIRO m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue SIRO m -> ResultItem m)
-> ResultValue SIRO m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue SIRO m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue SIRO m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue SIRO m -> ResultItem m)
-> ResultValue SIRO m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue SIRO m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

instance ResultItemable (ResultValue StaticPriorities) where

  resultItemName :: ResultValue StaticPriorities m -> ResultName
resultItemName = ResultValue StaticPriorities m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName
  resultItemNamePath :: ResultValue StaticPriorities m -> [ResultName]
resultItemNamePath = ResultValue StaticPriorities m -> [ResultName]
forall e (m :: * -> *). ResultValue e m -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue StaticPriorities m -> ResultId
resultItemId = ResultValue StaticPriorities m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId
  resultItemIdPath :: ResultValue StaticPriorities m -> [ResultId]
resultItemIdPath = ResultValue StaticPriorities m -> [ResultId]
forall e (m :: * -> *). ResultValue e m -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue StaticPriorities m -> ResultSignal m
resultItemSignal = ResultValue StaticPriorities m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal
  
  resultItemAsIntValue :: ResultValue StaticPriorities m -> Maybe (ResultValue Int m)
resultItemAsIntValue = Maybe (ResultValue Int m)
-> ResultValue StaticPriorities m -> Maybe (ResultValue Int m)
forall a b. a -> b -> a
const Maybe (ResultValue Int m)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue StaticPriorities m -> Maybe (ResultValue [Int] m)
resultItemAsIntListValue = Maybe (ResultValue [Int] m)
-> ResultValue StaticPriorities m -> Maybe (ResultValue [Int] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Int] m)
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue StaticPriorities m
-> Maybe (ResultValue (SamplingStats Int) m)
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int) m)
-> ResultValue StaticPriorities m
-> Maybe (ResultValue (SamplingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int) m)
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue StaticPriorities m
-> Maybe (ResultValue (TimingStats Int) m)
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int) m)
-> ResultValue StaticPriorities m
-> Maybe (ResultValue (TimingStats Int) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int) m)
forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue StaticPriorities m -> Maybe (ResultValue Double m)
resultItemAsDoubleValue = Maybe (ResultValue Double m)
-> ResultValue StaticPriorities m -> Maybe (ResultValue Double m)
forall a b. a -> b -> a
const Maybe (ResultValue Double m)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue StaticPriorities m -> Maybe (ResultValue [Double] m)
resultItemAsDoubleListValue = Maybe (ResultValue [Double] m)
-> ResultValue StaticPriorities m -> Maybe (ResultValue [Double] m)
forall a b. a -> b -> a
const Maybe (ResultValue [Double] m)
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue StaticPriorities m
-> Maybe (ResultValue (SamplingStats Double) m)
resultItemAsDoubleStatsValue = Maybe (ResultValue (SamplingStats Double) m)
-> ResultValue StaticPriorities m
-> Maybe (ResultValue (SamplingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Double) m)
forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue StaticPriorities m
-> Maybe (ResultValue (TimingStats Double) m)
resultItemAsDoubleTimingStatsValue = Maybe (ResultValue (TimingStats Double) m)
-> ResultValue StaticPriorities m
-> Maybe (ResultValue (TimingStats Double) m)
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double) m)
forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue StaticPriorities m -> Maybe (ResultValue ResultName m)
resultItemAsStringValue = ResultValue ResultName m -> Maybe (ResultValue ResultName m)
forall a. a -> Maybe a
Just (ResultValue ResultName m -> Maybe (ResultValue ResultName m))
-> (ResultValue StaticPriorities m -> ResultValue ResultName m)
-> ResultValue StaticPriorities m
-> Maybe (ResultValue ResultName m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StaticPriorities -> ResultName)
-> ResultValue StaticPriorities m -> ResultValue ResultName m
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> ResultValue a m -> ResultValue b m
mapResultValue StaticPriorities -> ResultName
forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue StaticPriorities m -> ResultSource m
resultItemExpansion = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue StaticPriorities m -> ResultItem m)
-> ResultValue StaticPriorities m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue StaticPriorities m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem
  resultItemSummary :: ResultValue StaticPriorities m -> ResultSource m
resultItemSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue StaticPriorities m -> ResultItem m)
-> ResultValue StaticPriorities m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue StaticPriorities m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem

-- | Flatten the result source.
flattenResultSource :: ResultSource m -> [ResultItem m]
flattenResultSource :: ResultSource m -> [ResultItem m]
flattenResultSource (ResultItemSource ResultItem m
x) = [ResultItem m
x]
flattenResultSource (ResultObjectSource ResultObject m
x) =
  [[ResultItem m]] -> [ResultItem m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultItem m]] -> [ResultItem m])
-> [[ResultItem m]] -> [ResultItem m]
forall a b. (a -> b) -> a -> b
$ (ResultProperty m -> [ResultItem m])
-> [ResultProperty m] -> [[ResultItem m]]
forall a b. (a -> b) -> [a] -> [b]
map (ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource (ResultSource m -> [ResultItem m])
-> (ResultProperty m -> ResultSource m)
-> ResultProperty m
-> [ResultItem m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultProperty m -> ResultSource m
forall (m :: * -> *). ResultProperty m -> ResultSource m
resultPropertySource) ([ResultProperty m] -> [[ResultItem m]])
-> [ResultProperty m] -> [[ResultItem m]]
forall a b. (a -> b) -> a -> b
$ ResultObject m -> [ResultProperty m]
forall (m :: * -> *). ResultObject m -> [ResultProperty m]
resultObjectProperties ResultObject m
x
flattenResultSource (ResultVectorSource ResultVector m
x) =
  [[ResultItem m]] -> [ResultItem m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultItem m]] -> [ResultItem m])
-> [[ResultItem m]] -> [ResultItem m]
forall a b. (a -> b) -> a -> b
$ (ResultSource m -> [ResultItem m])
-> [ResultSource m] -> [[ResultItem m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource ([ResultSource m] -> [[ResultItem m]])
-> [ResultSource m] -> [[ResultItem m]]
forall a b. (a -> b) -> a -> b
$ Array Int (ResultSource m) -> [ResultSource m]
forall i e. Array i e -> [e]
A.elems (Array Int (ResultSource m) -> [ResultSource m])
-> Array Int (ResultSource m) -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
x
flattenResultSource (ResultSeparatorSource ResultSeparator
x) = []

-- | Return the result source name.
resultSourceName :: ResultSource m -> ResultName
resultSourceName :: ResultSource m -> ResultName
resultSourceName (ResultItemSource (ResultItem a m
x)) = a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
x
resultSourceName (ResultObjectSource ResultObject m
x) = ResultObject m -> ResultName
forall (m :: * -> *). ResultObject m -> ResultName
resultObjectName ResultObject m
x
resultSourceName (ResultVectorSource ResultVector m
x) = ResultVector m -> ResultName
forall (m :: * -> *). ResultVector m -> ResultName
resultVectorName ResultVector m
x
resultSourceName (ResultSeparatorSource ResultSeparator
x) = []

-- | Expand the result source returning a more detailed version expanding the properties as possible.
expandResultSource :: MonadDES m => ResultSource m -> ResultSource m
expandResultSource :: ResultSource m -> ResultSource m
expandResultSource (ResultItemSource (ResultItem a m
x)) = a m -> ResultSource m
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> ResultSource m
resultItemExpansion a m
x
expandResultSource (ResultObjectSource ResultObject m
x) =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject m
x { resultObjectProperties :: [ResultProperty m]
resultObjectProperties =
         ((ResultProperty m -> ResultProperty m)
 -> [ResultProperty m] -> [ResultProperty m])
-> [ResultProperty m]
-> (ResultProperty m -> ResultProperty m)
-> [ResultProperty m]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultProperty m -> ResultProperty m)
-> [ResultProperty m] -> [ResultProperty m]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ResultObject m -> [ResultProperty m]
forall (m :: * -> *). ResultObject m -> [ResultProperty m]
resultObjectProperties ResultObject m
x) ((ResultProperty m -> ResultProperty m) -> [ResultProperty m])
-> (ResultProperty m -> ResultProperty m) -> [ResultProperty m]
forall a b. (a -> b) -> a -> b
$ \ResultProperty m
p ->
         ResultProperty m
p { resultPropertySource :: ResultSource m
resultPropertySource = ResultSource m -> ResultSource m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSource m
expandResultSource (ResultProperty m -> ResultSource m
forall (m :: * -> *). ResultProperty m -> ResultSource m
resultPropertySource ResultProperty m
p) } }
expandResultSource (ResultVectorSource ResultVector m
x) =
  ResultVector m -> ResultSource m
forall (m :: * -> *). ResultVector m -> ResultSource m
ResultVectorSource (ResultVector m -> ResultSource m)
-> ResultVector m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultVector m
x { resultVectorItems :: Array Int (ResultSource m)
resultVectorItems =
         (Int, Int) -> [(Int, ResultSource m)] -> Array Int (ResultSource m)
forall i e. Ix i => (i, i) -> [(i, e)] -> Array i e
A.array (Int, Int)
bnds [(Int
i, ResultSource m -> ResultSource m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSource m
expandResultSource ResultSource m
e) | (Int
i, ResultSource m
e) <- [(Int, ResultSource m)]
ies] }
    where arr :: Array Int (ResultSource m)
arr  = ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
x
          bnds :: (Int, Int)
bnds = Array Int (ResultSource m) -> (Int, Int)
forall i e. Array i e -> (i, i)
A.bounds Array Int (ResultSource m)
arr
          ies :: [(Int, ResultSource m)]
ies  = Array Int (ResultSource m) -> [(Int, ResultSource m)]
forall i e. Ix i => Array i e -> [(i, e)]
A.assocs Array Int (ResultSource m)
arr
expandResultSource z :: ResultSource m
z@(ResultSeparatorSource ResultSeparator
x) = ResultSource m
z

-- | Return a summarised and usually more short version of the result source expanding the main properties or excluding auxiliary properties if required.
resultSourceSummary :: MonadDES m => ResultSource m -> ResultSource m
resultSourceSummary :: ResultSource m -> ResultSource m
resultSourceSummary (ResultItemSource (ResultItem a m
x)) = a m -> ResultSource m
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> ResultSource m
resultItemSummary a m
x
resultSourceSummary (ResultObjectSource ResultObject m
x) = ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
resultObjectSummary ResultObject m
x
resultSourceSummary (ResultVectorSource ResultVector m
x) = ResultVector m -> ResultSource m
forall (m :: * -> *). ResultVector m -> ResultSource m
resultVectorSummary ResultVector m
x
resultSourceSummary z :: ResultSource m
z@(ResultSeparatorSource ResultSeparator
x) = ResultSource m
z

-- | Return a signal emitted by the source.
resultSourceSignal :: MonadDES m => ResultSource m -> ResultSignal m
resultSourceSignal :: ResultSource m -> ResultSignal m
resultSourceSignal (ResultItemSource (ResultItem a m
x)) = a m -> ResultSignal m
forall (a :: (* -> *) -> *) (m :: * -> *).
(ResultItemable a, MonadDES m) =>
a m -> ResultSignal m
resultItemSignal a m
x
resultSourceSignal (ResultObjectSource ResultObject m
x) = ResultObject m -> ResultSignal m
forall (m :: * -> *). ResultObject m -> ResultSignal m
resultObjectSignal ResultObject m
x
resultSourceSignal (ResultVectorSource ResultVector m
x) = ResultVector m -> ResultSignal m
forall (m :: * -> *). ResultVector m -> ResultSignal m
resultVectorSignal ResultVector m
x
resultSourceSignal (ResultSeparatorSource ResultSeparator
x) = ResultSignal m
forall (m :: * -> *). ResultSignal m
EmptyResultSignal

-- | Represent the result source as integer numbers.
resultSourceToIntValues :: MonadDES m => ResultSource m -> [ResultValue Int m]
resultSourceToIntValues :: ResultSource m -> [ResultValue Int m]
resultSourceToIntValues = (ResultItem m -> ResultValue Int m)
-> [ResultItem m] -> [ResultValue Int m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue Int m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue Int m
resultItemToIntValue a m
x) ([ResultItem m] -> [ResultValue Int m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue Int m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as lists of integer numbers.
resultSourceToIntListValues :: MonadDES m => ResultSource m -> [ResultValue [Int] m]
resultSourceToIntListValues :: ResultSource m -> [ResultValue [Int] m]
resultSourceToIntListValues = (ResultItem m -> ResultValue [Int] m)
-> [ResultItem m] -> [ResultValue [Int] m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue [Int] m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue [Int] m
resultItemToIntListValue a m
x) ([ResultItem m] -> [ResultValue [Int] m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue [Int] m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as statistics based on integer numbers.
resultSourceToIntStatsValues :: MonadDES m => ResultSource m -> [ResultValue (SamplingStats Int) m]
resultSourceToIntStatsValues :: ResultSource m -> [ResultValue (SamplingStats Int) m]
resultSourceToIntStatsValues = (ResultItem m -> ResultValue (SamplingStats Int) m)
-> [ResultItem m] -> [ResultValue (SamplingStats Int) m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue (SamplingStats Int) m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue (SamplingStats Int) m
resultItemToIntStatsValue a m
x) ([ResultItem m] -> [ResultValue (SamplingStats Int) m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue (SamplingStats Int) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as statistics based on integer numbers and optimised for fast aggregation.
resultSourceToIntStatsEitherValues :: MonadDES m => ResultSource m -> [ResultValue (Either Int (SamplingStats Int)) m]
resultSourceToIntStatsEitherValues :: ResultSource m -> [ResultValue (Either Int (SamplingStats Int)) m]
resultSourceToIntStatsEitherValues = (ResultItem m -> ResultValue (Either Int (SamplingStats Int)) m)
-> [ResultItem m]
-> [ResultValue (Either Int (SamplingStats Int)) m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue (Either Int (SamplingStats Int)) m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue (Either Int (SamplingStats Int)) m
resultItemToIntStatsEitherValue a m
x) ([ResultItem m]
 -> [ResultValue (Either Int (SamplingStats Int)) m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue (Either Int (SamplingStats Int)) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as timing statistics based on integer numbers.
resultSourceToIntTimingStatsValues :: MonadDES m => ResultSource m -> [ResultValue (TimingStats Int) m]
resultSourceToIntTimingStatsValues :: ResultSource m -> [ResultValue (TimingStats Int) m]
resultSourceToIntTimingStatsValues = (ResultItem m -> ResultValue (TimingStats Int) m)
-> [ResultItem m] -> [ResultValue (TimingStats Int) m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue (TimingStats Int) m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue (TimingStats Int) m
resultItemToIntTimingStatsValue a m
x) ([ResultItem m] -> [ResultValue (TimingStats Int) m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue (TimingStats Int) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as double floating point numbers.
resultSourceToDoubleValues :: MonadDES m => ResultSource m -> [ResultValue Double m]
resultSourceToDoubleValues :: ResultSource m -> [ResultValue Double m]
resultSourceToDoubleValues = (ResultItem m -> ResultValue Double m)
-> [ResultItem m] -> [ResultValue Double m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue Double m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue Double m
resultItemToDoubleValue a m
x) ([ResultItem m] -> [ResultValue Double m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue Double m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as lists of double floating point numbers.
resultSourceToDoubleListValues :: MonadDES m => ResultSource m -> [ResultValue [Double] m]
resultSourceToDoubleListValues :: ResultSource m -> [ResultValue [Double] m]
resultSourceToDoubleListValues = (ResultItem m -> ResultValue [Double] m)
-> [ResultItem m] -> [ResultValue [Double] m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue [Double] m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue [Double] m
resultItemToDoubleListValue a m
x) ([ResultItem m] -> [ResultValue [Double] m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue [Double] m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as statistics based on double floating point numbers.
resultSourceToDoubleStatsValues :: MonadDES m => ResultSource m -> [ResultValue (SamplingStats Double) m]
resultSourceToDoubleStatsValues :: ResultSource m -> [ResultValue (SamplingStats Double) m]
resultSourceToDoubleStatsValues = (ResultItem m -> ResultValue (SamplingStats Double) m)
-> [ResultItem m] -> [ResultValue (SamplingStats Double) m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue (SamplingStats Double) m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue (SamplingStats Double) m
resultItemToDoubleStatsValue a m
x) ([ResultItem m] -> [ResultValue (SamplingStats Double) m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue (SamplingStats Double) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as statistics based on double floating point numbers and optimised for fast aggregation.
resultSourceToDoubleStatsEitherValues :: MonadDES m => ResultSource m -> [ResultValue (Either Double (SamplingStats Double)) m]
resultSourceToDoubleStatsEitherValues :: ResultSource m
-> [ResultValue (Either Double (SamplingStats Double)) m]
resultSourceToDoubleStatsEitherValues = (ResultItem m
 -> ResultValue (Either Double (SamplingStats Double)) m)
-> [ResultItem m]
-> [ResultValue (Either Double (SamplingStats Double)) m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue (Either Double (SamplingStats Double)) m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue (Either Double (SamplingStats Double)) m
resultItemToDoubleStatsEitherValue a m
x) ([ResultItem m]
 -> [ResultValue (Either Double (SamplingStats Double)) m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue (Either Double (SamplingStats Double)) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as timing statistics based on double floating point numbers.
resultSourceToDoubleTimingStatsValues :: MonadDES m => ResultSource m -> [ResultValue (TimingStats Double) m]
resultSourceToDoubleTimingStatsValues :: ResultSource m -> [ResultValue (TimingStats Double) m]
resultSourceToDoubleTimingStatsValues = (ResultItem m -> ResultValue (TimingStats Double) m)
-> [ResultItem m] -> [ResultValue (TimingStats Double) m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue (TimingStats Double) m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue (TimingStats Double) m
resultItemToDoubleTimingStatsValue a m
x) ([ResultItem m] -> [ResultValue (TimingStats Double) m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue (TimingStats Double) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | Represent the result source as string values.
resultSourceToStringValues :: MonadDES m => ResultSource m -> [ResultValue String m]
resultSourceToStringValues :: ResultSource m -> [ResultValue ResultName m]
resultSourceToStringValues = (ResultItem m -> ResultValue ResultName m)
-> [ResultItem m] -> [ResultValue ResultName m]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a m
x) -> a m -> ResultValue ResultName m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue ResultName m
resultItemToStringValue a m
x) ([ResultItem m] -> [ResultValue ResultName m])
-> (ResultSource m -> [ResultItem m])
-> ResultSource m
-> [ResultValue ResultName m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource m -> [ResultItem m]
forall (m :: * -> *). ResultSource m -> [ResultItem m]
flattenResultSource

-- | It contains the results of simulation.
data Results m =
  Results { Results m -> ResultSourceMap m
resultSourceMap :: ResultSourceMap m,
            -- ^ The sources of simulation results as a map of associated names.
            Results m -> [ResultSource m]
resultSourceList :: [ResultSource m]
            -- ^ The sources of simulation results as an ordered list.
          }

-- | It transforms the results of simulation.
type ResultTransform m = Results m -> Results m

-- | It representes the predefined signals provided by every simulation model.
data ResultPredefinedSignals m =
  ResultPredefinedSignals { ResultPredefinedSignals m -> Signal m Double
resultSignalInIntegTimes :: Signal m Double,
                            -- ^ The signal triggered in the integration time points.
                            ResultPredefinedSignals m -> Signal m Double
resultSignalInStartTime :: Signal m Double,
                            -- ^ The signal triggered in the start time.
                            ResultPredefinedSignals m -> Signal m Double
resultSignalInStopTime :: Signal m Double
                            -- ^ The signal triggered in the stop time.
                          }

-- | Create the predefined signals provided by every simulation model.
newResultPredefinedSignals :: MonadDES m => Simulation m (ResultPredefinedSignals m)
newResultPredefinedSignals :: Simulation m (ResultPredefinedSignals m)
newResultPredefinedSignals = Dynamics m (ResultPredefinedSignals m)
-> Simulation m (ResultPredefinedSignals m)
forall (m :: * -> *) a. Dynamics m a -> Simulation m a
runDynamicsInStartTime (Dynamics m (ResultPredefinedSignals m)
 -> Simulation m (ResultPredefinedSignals m))
-> Dynamics m (ResultPredefinedSignals m)
-> Simulation m (ResultPredefinedSignals m)
forall a b. (a -> b) -> a -> b
$ EventProcessing
-> Event m (ResultPredefinedSignals m)
-> Dynamics m (ResultPredefinedSignals m)
forall (m :: * -> *) a.
EventQueueing m =>
EventProcessing -> Event m a -> Dynamics m a
runEventWith EventProcessing
EarlierEvents Event m (ResultPredefinedSignals m)
d where
  d :: Event m (ResultPredefinedSignals m)
d = do Signal m Double
signalInIntegTimes <- Event m (Signal m Double)
forall (m :: * -> *). MonadDES m => Event m (Signal m Double)
newSignalInIntegTimes
         Signal m Double
signalInStartTime  <- Event m (Signal m Double)
forall (m :: * -> *). MonadDES m => Event m (Signal m Double)
newSignalInStartTime
         Signal m Double
signalInStopTime   <- Event m (Signal m Double)
forall (m :: * -> *). MonadDES m => Event m (Signal m Double)
newSignalInStopTime
         ResultPredefinedSignals m -> Event m (ResultPredefinedSignals m)
forall (m :: * -> *) a. Monad m => a -> m a
return ResultPredefinedSignals :: forall (m :: * -> *).
Signal m Double
-> Signal m Double -> Signal m Double -> ResultPredefinedSignals m
ResultPredefinedSignals { resultSignalInIntegTimes :: Signal m Double
resultSignalInIntegTimes = Signal m Double
signalInIntegTimes,
                                          resultSignalInStartTime :: Signal m Double
resultSignalInStartTime  = Signal m Double
signalInStartTime,
                                          resultSignalInStopTime :: Signal m Double
resultSignalInStopTime   = Signal m Double
signalInStopTime }

instance Semigroup (Results m) where

  Results m
x <> :: Results m -> Results m -> Results m
<> Results m
y = [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results ([ResultSource m] -> Results m) -> [ResultSource m] -> Results m
forall a b. (a -> b) -> a -> b
$ Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList Results m
x [ResultSource m] -> [ResultSource m] -> [ResultSource m]
forall a. Semigroup a => a -> a -> a
<> Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList Results m
y

instance Monoid (Results m) where

  mempty :: Results m
mempty  = [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results [ResultSource m]
forall a. Monoid a => a
mempty
  mappend :: Results m -> Results m -> Results m
mappend = Results m -> Results m -> Results m
forall a. Semigroup a => a -> a -> a
(<>)

-- | Prepare the simulation results.
results :: [ResultSource m] -> Results m
results :: [ResultSource m] -> Results m
results [ResultSource m]
ms =
  Results :: forall (m :: * -> *).
ResultSourceMap m -> [ResultSource m] -> Results m
Results { resultSourceMap :: ResultSourceMap m
resultSourceMap  = [(ResultName, ResultSource m)] -> ResultSourceMap m
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(ResultName, ResultSource m)] -> ResultSourceMap m)
-> [(ResultName, ResultSource m)] -> ResultSourceMap m
forall a b. (a -> b) -> a -> b
$ (ResultSource m -> (ResultName, ResultSource m))
-> [ResultSource m] -> [(ResultName, ResultSource m)]
forall a b. (a -> b) -> [a] -> [b]
map (\ResultSource m
x -> (ResultSource m -> ResultName
forall (m :: * -> *). ResultSource m -> ResultName
resultSourceName ResultSource m
x, ResultSource m
x)) [ResultSource m]
ms,
            resultSourceList :: [ResultSource m]
resultSourceList = [ResultSource m]
ms }

-- | Represent the results as integer numbers.
resultsToIntValues :: MonadDES m => Results m -> [ResultValue Int m]
resultsToIntValues :: Results m -> [ResultValue Int m]
resultsToIntValues = [[ResultValue Int m]] -> [ResultValue Int m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue Int m]] -> [ResultValue Int m])
-> (Results m -> [[ResultValue Int m]])
-> Results m
-> [ResultValue Int m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue Int m])
-> [ResultSource m] -> [[ResultValue Int m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue Int m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue Int m]
resultSourceToIntValues ([ResultSource m] -> [[ResultValue Int m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue Int m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as lists of integer numbers.
resultsToIntListValues :: MonadDES m => Results m -> [ResultValue [Int] m]
resultsToIntListValues :: Results m -> [ResultValue [Int] m]
resultsToIntListValues = [[ResultValue [Int] m]] -> [ResultValue [Int] m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue [Int] m]] -> [ResultValue [Int] m])
-> (Results m -> [[ResultValue [Int] m]])
-> Results m
-> [ResultValue [Int] m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue [Int] m])
-> [ResultSource m] -> [[ResultValue [Int] m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue [Int] m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue [Int] m]
resultSourceToIntListValues ([ResultSource m] -> [[ResultValue [Int] m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue [Int] m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as statistics based on integer numbers.
resultsToIntStatsValues :: MonadDES m => Results m -> [ResultValue (SamplingStats Int) m]
resultsToIntStatsValues :: Results m -> [ResultValue (SamplingStats Int) m]
resultsToIntStatsValues = [[ResultValue (SamplingStats Int) m]]
-> [ResultValue (SamplingStats Int) m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (SamplingStats Int) m]]
 -> [ResultValue (SamplingStats Int) m])
-> (Results m -> [[ResultValue (SamplingStats Int) m]])
-> Results m
-> [ResultValue (SamplingStats Int) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue (SamplingStats Int) m])
-> [ResultSource m] -> [[ResultValue (SamplingStats Int) m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue (SamplingStats Int) m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue (SamplingStats Int) m]
resultSourceToIntStatsValues ([ResultSource m] -> [[ResultValue (SamplingStats Int) m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue (SamplingStats Int) m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as statistics based on integer numbers and optimised for fast aggregation.
resultsToIntStatsEitherValues :: MonadDES m => Results m -> [ResultValue (Either Int (SamplingStats Int)) m]
resultsToIntStatsEitherValues :: Results m -> [ResultValue (Either Int (SamplingStats Int)) m]
resultsToIntStatsEitherValues = [[ResultValue (Either Int (SamplingStats Int)) m]]
-> [ResultValue (Either Int (SamplingStats Int)) m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (Either Int (SamplingStats Int)) m]]
 -> [ResultValue (Either Int (SamplingStats Int)) m])
-> (Results m
    -> [[ResultValue (Either Int (SamplingStats Int)) m]])
-> Results m
-> [ResultValue (Either Int (SamplingStats Int)) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m
 -> [ResultValue (Either Int (SamplingStats Int)) m])
-> [ResultSource m]
-> [[ResultValue (Either Int (SamplingStats Int)) m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue (Either Int (SamplingStats Int)) m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue (Either Int (SamplingStats Int)) m]
resultSourceToIntStatsEitherValues ([ResultSource m]
 -> [[ResultValue (Either Int (SamplingStats Int)) m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue (Either Int (SamplingStats Int)) m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as timing statistics based on integer numbers.
resultsToIntTimingStatsValues :: MonadDES m => Results m -> [ResultValue (TimingStats Int) m]
resultsToIntTimingStatsValues :: Results m -> [ResultValue (TimingStats Int) m]
resultsToIntTimingStatsValues = [[ResultValue (TimingStats Int) m]]
-> [ResultValue (TimingStats Int) m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (TimingStats Int) m]]
 -> [ResultValue (TimingStats Int) m])
-> (Results m -> [[ResultValue (TimingStats Int) m]])
-> Results m
-> [ResultValue (TimingStats Int) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue (TimingStats Int) m])
-> [ResultSource m] -> [[ResultValue (TimingStats Int) m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue (TimingStats Int) m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue (TimingStats Int) m]
resultSourceToIntTimingStatsValues ([ResultSource m] -> [[ResultValue (TimingStats Int) m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue (TimingStats Int) m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as double floating point numbers.
resultsToDoubleValues :: MonadDES m => Results m -> [ResultValue Double m]
resultsToDoubleValues :: Results m -> [ResultValue Double m]
resultsToDoubleValues = [[ResultValue Double m]] -> [ResultValue Double m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue Double m]] -> [ResultValue Double m])
-> (Results m -> [[ResultValue Double m]])
-> Results m
-> [ResultValue Double m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue Double m])
-> [ResultSource m] -> [[ResultValue Double m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue Double m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue Double m]
resultSourceToDoubleValues ([ResultSource m] -> [[ResultValue Double m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue Double m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as lists of double floating point numbers.
resultsToDoubleListValues :: MonadDES m => Results m -> [ResultValue [Double] m]
resultsToDoubleListValues :: Results m -> [ResultValue [Double] m]
resultsToDoubleListValues = [[ResultValue [Double] m]] -> [ResultValue [Double] m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue [Double] m]] -> [ResultValue [Double] m])
-> (Results m -> [[ResultValue [Double] m]])
-> Results m
-> [ResultValue [Double] m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue [Double] m])
-> [ResultSource m] -> [[ResultValue [Double] m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue [Double] m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue [Double] m]
resultSourceToDoubleListValues ([ResultSource m] -> [[ResultValue [Double] m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue [Double] m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as statistics based on double floating point numbers.
resultsToDoubleStatsValues :: MonadDES m => Results m -> [ResultValue (SamplingStats Double) m]
resultsToDoubleStatsValues :: Results m -> [ResultValue (SamplingStats Double) m]
resultsToDoubleStatsValues = [[ResultValue (SamplingStats Double) m]]
-> [ResultValue (SamplingStats Double) m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (SamplingStats Double) m]]
 -> [ResultValue (SamplingStats Double) m])
-> (Results m -> [[ResultValue (SamplingStats Double) m]])
-> Results m
-> [ResultValue (SamplingStats Double) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue (SamplingStats Double) m])
-> [ResultSource m] -> [[ResultValue (SamplingStats Double) m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue (SamplingStats Double) m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue (SamplingStats Double) m]
resultSourceToDoubleStatsValues ([ResultSource m] -> [[ResultValue (SamplingStats Double) m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue (SamplingStats Double) m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as statistics based on double floating point numbers and optimised for fast aggregation.
resultsToDoubleStatsEitherValues :: MonadDES m => Results m -> [ResultValue (Either Double (SamplingStats Double)) m]
resultsToDoubleStatsEitherValues :: Results m -> [ResultValue (Either Double (SamplingStats Double)) m]
resultsToDoubleStatsEitherValues = [[ResultValue (Either Double (SamplingStats Double)) m]]
-> [ResultValue (Either Double (SamplingStats Double)) m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (Either Double (SamplingStats Double)) m]]
 -> [ResultValue (Either Double (SamplingStats Double)) m])
-> (Results m
    -> [[ResultValue (Either Double (SamplingStats Double)) m]])
-> Results m
-> [ResultValue (Either Double (SamplingStats Double)) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m
 -> [ResultValue (Either Double (SamplingStats Double)) m])
-> [ResultSource m]
-> [[ResultValue (Either Double (SamplingStats Double)) m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m
-> [ResultValue (Either Double (SamplingStats Double)) m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m
-> [ResultValue (Either Double (SamplingStats Double)) m]
resultSourceToDoubleStatsEitherValues ([ResultSource m]
 -> [[ResultValue (Either Double (SamplingStats Double)) m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue (Either Double (SamplingStats Double)) m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as timing statistics based on double floating point numbers.
resultsToDoubleTimingStatsValues :: MonadDES m => Results m -> [ResultValue (TimingStats Double) m]
resultsToDoubleTimingStatsValues :: Results m -> [ResultValue (TimingStats Double) m]
resultsToDoubleTimingStatsValues = [[ResultValue (TimingStats Double) m]]
-> [ResultValue (TimingStats Double) m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (TimingStats Double) m]]
 -> [ResultValue (TimingStats Double) m])
-> (Results m -> [[ResultValue (TimingStats Double) m]])
-> Results m
-> [ResultValue (TimingStats Double) m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue (TimingStats Double) m])
-> [ResultSource m] -> [[ResultValue (TimingStats Double) m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue (TimingStats Double) m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue (TimingStats Double) m]
resultSourceToDoubleTimingStatsValues ([ResultSource m] -> [[ResultValue (TimingStats Double) m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue (TimingStats Double) m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Represent the results as string values.
resultsToStringValues :: MonadDES m => Results m -> [ResultValue String m]
resultsToStringValues :: Results m -> [ResultValue ResultName m]
resultsToStringValues = [[ResultValue ResultName m]] -> [ResultValue ResultName m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue ResultName m]] -> [ResultValue ResultName m])
-> (Results m -> [[ResultValue ResultName m]])
-> Results m
-> [ResultValue ResultName m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultValue ResultName m])
-> [ResultSource m] -> [[ResultValue ResultName m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultValue ResultName m]
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> [ResultValue ResultName m]
resultSourceToStringValues ([ResultSource m] -> [[ResultValue ResultName m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultValue ResultName m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Return a signal emitted by the specified results.
resultSignal :: MonadDES m => Results m -> ResultSignal m
resultSignal :: Results m -> ResultSignal m
resultSignal = [ResultSignal m] -> ResultSignal m
forall a. Monoid a => [a] -> a
mconcat ([ResultSignal m] -> ResultSignal m)
-> (Results m -> [ResultSignal m]) -> Results m -> ResultSignal m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> ResultSignal m)
-> [ResultSource m] -> [ResultSignal m]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> ResultSignal m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSignal m
resultSourceSignal ([ResultSource m] -> [ResultSignal m])
-> (Results m -> [ResultSource m]) -> Results m -> [ResultSignal m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Return an expanded version of the simulation results expanding the properties as possible, which
-- takes place for expanding statistics to show the count, average, deviation, minimum, maximum etc.
-- as separate values.
expandResults :: MonadDES m => ResultTransform m
expandResults :: ResultTransform m
expandResults = [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results ([ResultSource m] -> Results m)
-> (Results m -> [ResultSource m]) -> ResultTransform m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> ResultSource m)
-> [ResultSource m] -> [ResultSource m]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> ResultSource m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSource m
expandResultSource ([ResultSource m] -> [ResultSource m])
-> (Results m -> [ResultSource m]) -> Results m -> [ResultSource m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Return a short version of the simulation results, i.e. their summary, expanding the main properties
-- or excluding auxiliary properties if required.
resultSummary :: MonadDES m => ResultTransform m
resultSummary :: ResultTransform m
resultSummary = [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results ([ResultSource m] -> Results m)
-> (Results m -> [ResultSource m]) -> ResultTransform m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> ResultSource m)
-> [ResultSource m] -> [ResultSource m]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> ResultSource m
forall (m :: * -> *).
MonadDES m =>
ResultSource m -> ResultSource m
resultSourceSummary ([ResultSource m] -> [ResultSource m])
-> (Results m -> [ResultSource m]) -> Results m -> [ResultSource m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Take a result by its name.
resultByName :: ResultName -> ResultTransform m
resultByName :: ResultName -> ResultTransform m
resultByName ResultName
name Results m
rs =
  case ResultName
-> Map ResultName (ResultSource m) -> Maybe (ResultSource m)
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup ResultName
name (Results m -> Map ResultName (ResultSource m)
forall (m :: * -> *). Results m -> ResultSourceMap m
resultSourceMap Results m
rs) of
    Just ResultSource m
x -> [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results [ResultSource m
x]
    Maybe (ResultSource m)
Nothing ->
      ResultName -> Results m
forall a. HasCallStack => ResultName -> a
error (ResultName -> Results m) -> ResultName -> Results m
forall a b. (a -> b) -> a -> b
$
      ResultName
"Not found result source with name " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
name ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
      ResultName
": resultByName"

-- | Take a result from the object with the specified property label,
-- but it is more preferrable to refer to the property by its 'ResultId'
-- identifier with help of the 'resultById' function.
resultByProperty :: ResultName -> ResultTransform m
resultByProperty :: ResultName -> ResultTransform m
resultByProperty ResultName
label Results m
rs = ((ResultSource m -> [ResultSource m]) -> ResultTransform m)
-> Results m -> (ResultSource m -> [ResultSource m]) -> Results m
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource m -> [ResultSource m]) -> ResultTransform m
forall (m :: * -> *).
(ResultSource m -> [ResultSource m]) -> ResultTransform m
composeResults Results m
rs ResultSource m -> [ResultSource m]
forall (m :: * -> *). ResultSource m -> [ResultSource m]
loop
  where
    loop :: ResultSource m -> [ResultSource m]
loop ResultSource m
x =
      case ResultSource m
x of
        ResultObjectSource ResultObject m
s ->
          let ps :: [ResultProperty m]
ps =
                ((ResultProperty m -> Bool)
 -> [ResultProperty m] -> [ResultProperty m])
-> [ResultProperty m]
-> (ResultProperty m -> Bool)
-> [ResultProperty m]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultProperty m -> Bool)
-> [ResultProperty m] -> [ResultProperty m]
forall a. (a -> Bool) -> [a] -> [a]
filter (ResultObject m -> [ResultProperty m]
forall (m :: * -> *). ResultObject m -> [ResultProperty m]
resultObjectProperties ResultObject m
s) ((ResultProperty m -> Bool) -> [ResultProperty m])
-> (ResultProperty m -> Bool) -> [ResultProperty m]
forall a b. (a -> b) -> a -> b
$ \ResultProperty m
p ->
                ResultProperty m -> ResultName
forall (m :: * -> *). ResultProperty m -> ResultName
resultPropertyLabel ResultProperty m
p ResultName -> ResultName -> Bool
forall a. Eq a => a -> a -> Bool
== ResultName
label
          in case [ResultProperty m]
ps of
            [] ->
              ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
              ResultName
"Not found property " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
label ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
" for object " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultObject m -> ResultName
forall (m :: * -> *). ResultObject m -> ResultName
resultObjectName ResultObject m
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
": resultByProperty"
            [ResultProperty m]
ps ->
              (ResultProperty m -> ResultSource m)
-> [ResultProperty m] -> [ResultSource m]
forall a b. (a -> b) -> [a] -> [b]
map ResultProperty m -> ResultSource m
forall (m :: * -> *). ResultProperty m -> ResultSource m
resultPropertySource [ResultProperty m]
ps
        ResultVectorSource ResultVector m
s ->
          [[ResultSource m]] -> [ResultSource m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource m]] -> [ResultSource m])
-> [[ResultSource m]] -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ (ResultSource m -> [ResultSource m])
-> [ResultSource m] -> [[ResultSource m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultSource m]
loop ([ResultSource m] -> [[ResultSource m]])
-> [ResultSource m] -> [[ResultSource m]]
forall a b. (a -> b) -> a -> b
$ Array Int (ResultSource m) -> [ResultSource m]
forall i e. Array i e -> [e]
A.elems (Array Int (ResultSource m) -> [ResultSource m])
-> Array Int (ResultSource m) -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
s
        ResultSource m
x ->
          ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource m -> ResultName
forall (m :: * -> *). ResultSource m -> ResultName
resultSourceName ResultSource m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is neither object, nor vector " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
": resultByProperty"

-- | Take a result from the object with the specified identifier. It can identify
-- an item, object property, the object iself, vector or its elements.
resultById :: ResultId -> ResultTransform m
resultById :: ResultId -> ResultTransform m
resultById ResultId
i Results m
rs = ((ResultSource m -> [ResultSource m]) -> ResultTransform m)
-> Results m -> (ResultSource m -> [ResultSource m]) -> Results m
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource m -> [ResultSource m]) -> ResultTransform m
forall (m :: * -> *).
(ResultSource m -> [ResultSource m]) -> ResultTransform m
composeResults Results m
rs ResultSource m -> [ResultSource m]
forall (m :: * -> *). ResultSource m -> [ResultSource m]
loop
  where
    loop :: ResultSource m -> [ResultSource m]
loop ResultSource m
x =
      case ResultSource m
x of
        ResultItemSource (ResultItem a m
s) ->
          if a m -> ResultId
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultId
resultItemId a m
s ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource m
x]
          else ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
               ResultName
"Expected to find item with Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show ResultId
i ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
               ResultName
", while the item " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a m -> ResultName
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultName
resultItemName a m
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
               ResultName
" has actual Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show (a m -> ResultId
forall (a :: (* -> *) -> *) (m :: * -> *).
ResultItemable a =>
a m -> ResultId
resultItemId a m
s) ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
               ResultName
": resultById"
        ResultObjectSource ResultObject m
s ->
          if ResultObject m -> ResultId
forall (m :: * -> *). ResultObject m -> ResultId
resultObjectId ResultObject m
s ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource m
x]
          else let ps :: [ResultProperty m]
ps =
                     ((ResultProperty m -> Bool)
 -> [ResultProperty m] -> [ResultProperty m])
-> [ResultProperty m]
-> (ResultProperty m -> Bool)
-> [ResultProperty m]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultProperty m -> Bool)
-> [ResultProperty m] -> [ResultProperty m]
forall a. (a -> Bool) -> [a] -> [a]
filter (ResultObject m -> [ResultProperty m]
forall (m :: * -> *). ResultObject m -> [ResultProperty m]
resultObjectProperties ResultObject m
s) ((ResultProperty m -> Bool) -> [ResultProperty m])
-> (ResultProperty m -> Bool) -> [ResultProperty m]
forall a b. (a -> b) -> a -> b
$ \ResultProperty m
p ->
                     ResultProperty m -> ResultId
forall (m :: * -> *). ResultProperty m -> ResultId
resultPropertyId ResultProperty m
p ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
               in case [ResultProperty m]
ps of
                 [] ->
                   ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
                   ResultName
"Not found property with Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show ResultId
i ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
                   ResultName
" for object " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultObject m -> ResultName
forall (m :: * -> *). ResultObject m -> ResultName
resultObjectName ResultObject m
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
                   ResultName
" that has actual Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show (ResultObject m -> ResultId
forall (m :: * -> *). ResultObject m -> ResultId
resultObjectId ResultObject m
s) ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
                   ResultName
": resultById"
                 [ResultProperty m]
ps ->
                   (ResultProperty m -> ResultSource m)
-> [ResultProperty m] -> [ResultSource m]
forall a b. (a -> b) -> [a] -> [b]
map ResultProperty m -> ResultSource m
forall (m :: * -> *). ResultProperty m -> ResultSource m
resultPropertySource [ResultProperty m]
ps
        ResultVectorSource ResultVector m
s ->
          if ResultVector m -> ResultId
forall (m :: * -> *). ResultVector m -> ResultId
resultVectorId ResultVector m
s ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource m
x]
          else [[ResultSource m]] -> [ResultSource m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource m]] -> [ResultSource m])
-> [[ResultSource m]] -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ (ResultSource m -> [ResultSource m])
-> [ResultSource m] -> [[ResultSource m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultSource m]
loop ([ResultSource m] -> [[ResultSource m]])
-> [ResultSource m] -> [[ResultSource m]]
forall a b. (a -> b) -> a -> b
$ Array Int (ResultSource m) -> [ResultSource m]
forall i e. Array i e -> [e]
A.elems (Array Int (ResultSource m) -> [ResultSource m])
-> Array Int (ResultSource m) -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
s
        ResultSource m
x ->
          ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource m -> ResultName
forall (m :: * -> *). ResultSource m -> ResultName
resultSourceName ResultSource m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is neither item, nor object, nor vector " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
": resultById"

-- | Take a result from the vector by the specified integer index.
resultByIndex :: Int -> ResultTransform m
resultByIndex :: Int -> ResultTransform m
resultByIndex Int
index Results m
rs = ((ResultSource m -> [ResultSource m]) -> ResultTransform m)
-> Results m -> (ResultSource m -> [ResultSource m]) -> Results m
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource m -> [ResultSource m]) -> ResultTransform m
forall (m :: * -> *).
(ResultSource m -> [ResultSource m]) -> ResultTransform m
composeResults Results m
rs ResultSource m -> [ResultSource m]
forall (m :: * -> *). ResultSource m -> [ResultSource m]
loop
  where
    loop :: ResultSource m -> [ResultSource m]
loop ResultSource m
x =
      case ResultSource m
x of
        ResultVectorSource ResultVector m
s ->
          [ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
s Array Int (ResultSource m) -> Int -> ResultSource m
forall i e. Ix i => Array i e -> i -> e
A.! Int
index] 
        ResultSource m
x ->
          ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource m -> ResultName
forall (m :: * -> *). ResultSource m -> ResultName
resultSourceName ResultSource m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is not vector " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
": resultByIndex"

-- | Take a result from the vector by the specified string subscript.
resultBySubscript :: ResultName -> ResultTransform m
resultBySubscript :: ResultName -> ResultTransform m
resultBySubscript ResultName
subscript Results m
rs = ((ResultSource m -> [ResultSource m]) -> ResultTransform m)
-> Results m -> (ResultSource m -> [ResultSource m]) -> Results m
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource m -> [ResultSource m]) -> ResultTransform m
forall (m :: * -> *).
(ResultSource m -> [ResultSource m]) -> ResultTransform m
composeResults Results m
rs ResultSource m -> [ResultSource m]
forall (m :: * -> *). ResultSource m -> [ResultSource m]
loop
  where
    loop :: ResultSource m -> [ResultSource m]
loop ResultSource m
x =
      case ResultSource m
x of
        ResultVectorSource ResultVector m
s ->
          let ys :: [ResultSource m]
ys = Array Int (ResultSource m) -> [ResultSource m]
forall i e. Array i e -> [e]
A.elems (Array Int (ResultSource m) -> [ResultSource m])
-> Array Int (ResultSource m) -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ ResultVector m -> Array Int (ResultSource m)
forall (m :: * -> *). ResultVector m -> Array Int (ResultSource m)
resultVectorItems ResultVector m
s
              zs :: [ResultName]
zs = Array Int ResultName -> [ResultName]
forall i e. Array i e -> [e]
A.elems (Array Int ResultName -> [ResultName])
-> Array Int ResultName -> [ResultName]
forall a b. (a -> b) -> a -> b
$ ResultVector m -> Array Int ResultName
forall (m :: * -> *). ResultVector m -> Array Int ResultName
resultVectorSubscript ResultVector m
s
              ps :: [(ResultSource m, ResultName)]
ps =
                (((ResultSource m, ResultName) -> Bool)
 -> [(ResultSource m, ResultName)]
 -> [(ResultSource m, ResultName)])
-> [(ResultSource m, ResultName)]
-> ((ResultSource m, ResultName) -> Bool)
-> [(ResultSource m, ResultName)]
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((ResultSource m, ResultName) -> Bool)
-> [(ResultSource m, ResultName)] -> [(ResultSource m, ResultName)]
forall a. (a -> Bool) -> [a] -> [a]
filter ([ResultSource m] -> [ResultName] -> [(ResultSource m, ResultName)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ResultSource m]
ys [ResultName]
zs) (((ResultSource m, ResultName) -> Bool)
 -> [(ResultSource m, ResultName)])
-> ((ResultSource m, ResultName) -> Bool)
-> [(ResultSource m, ResultName)]
forall a b. (a -> b) -> a -> b
$ \(ResultSource m
y, ResultName
z) ->
                ResultName
z ResultName -> ResultName -> Bool
forall a. Eq a => a -> a -> Bool
== ResultName
subscript
          in case [(ResultSource m, ResultName)]
ps of
            [] ->
              ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
              ResultName
"Not found subscript " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
subscript ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
" for vector " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultVector m -> ResultName
forall (m :: * -> *). ResultVector m -> ResultName
resultVectorName ResultVector m
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
": resultBySubscript"
            [(ResultSource m, ResultName)]
ps ->
              ((ResultSource m, ResultName) -> ResultSource m)
-> [(ResultSource m, ResultName)] -> [ResultSource m]
forall a b. (a -> b) -> [a] -> [b]
map (ResultSource m, ResultName) -> ResultSource m
forall a b. (a, b) -> a
fst [(ResultSource m, ResultName)]
ps
        ResultSource m
x ->
          ResultName -> [ResultSource m]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource m]) -> ResultName -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource m -> ResultName
forall (m :: * -> *). ResultSource m -> ResultName
resultSourceName ResultSource m
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is not vector " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
": resultBySubscript"

-- | Compose the results using the specified transformation function.
composeResults :: (ResultSource m -> [ResultSource m]) -> ResultTransform m
composeResults :: (ResultSource m -> [ResultSource m]) -> ResultTransform m
composeResults ResultSource m -> [ResultSource m]
f =
  [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results ([ResultSource m] -> Results m)
-> (Results m -> [ResultSource m]) -> ResultTransform m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[ResultSource m]] -> [ResultSource m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource m]] -> [ResultSource m])
-> (Results m -> [[ResultSource m]])
-> Results m
-> [ResultSource m]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource m -> [ResultSource m])
-> [ResultSource m] -> [[ResultSource m]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource m -> [ResultSource m]
f ([ResultSource m] -> [[ResultSource m]])
-> (Results m -> [ResultSource m])
-> Results m
-> [[ResultSource m]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList

-- | Concatenate the results using the specified list of transformation functions.
concatResults :: [ResultTransform m] -> ResultTransform m
concatResults :: [ResultTransform m] -> ResultTransform m
concatResults [ResultTransform m]
trs Results m
rs =
  [ResultSource m] -> Results m
forall (m :: * -> *). [ResultSource m] -> Results m
results ([ResultSource m] -> Results m) -> [ResultSource m] -> Results m
forall a b. (a -> b) -> a -> b
$ [[ResultSource m]] -> [ResultSource m]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource m]] -> [ResultSource m])
-> [[ResultSource m]] -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ (ResultTransform m -> [ResultSource m])
-> [ResultTransform m] -> [[ResultSource m]]
forall a b. (a -> b) -> [a] -> [b]
map (\ResultTransform m
tr -> Results m -> [ResultSource m]
forall (m :: * -> *). Results m -> [ResultSource m]
resultSourceList (Results m -> [ResultSource m]) -> Results m -> [ResultSource m]
forall a b. (a -> b) -> a -> b
$ ResultTransform m
tr Results m
rs) [ResultTransform m]
trs

-- | Append the results using the specified transformation functions.
appendResults :: ResultTransform m -> ResultTransform m -> ResultTransform m
appendResults :: ResultTransform m -> ResultTransform m -> ResultTransform m
appendResults ResultTransform m
x ResultTransform m
y =
  [ResultTransform m] -> ResultTransform m
forall (m :: * -> *). [ResultTransform m] -> ResultTransform m
concatResults [ResultTransform m
x, ResultTransform m
y]

-- | Return a pure signal as a result of combination of the predefined signals
-- with the specified result signal usually provided by the sources.
--
-- The signal returned is triggered when the source signal is triggered.
-- The pure signal is also triggered in the integration time points
-- if the source signal is unknown or it was combined with any unknown signal.
pureResultSignal :: MonadDES m => ResultPredefinedSignals m -> ResultSignal m -> Signal m ()
pureResultSignal :: ResultPredefinedSignals m -> ResultSignal m -> Signal m ()
pureResultSignal ResultPredefinedSignals m
rs ResultSignal m
EmptyResultSignal =
  Signal m Double -> Signal m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals m -> Signal m Double
forall (m :: * -> *). ResultPredefinedSignals m -> Signal m Double
resultSignalInStartTime ResultPredefinedSignals m
rs)
pureResultSignal ResultPredefinedSignals m
rs ResultSignal m
UnknownResultSignal =
  Signal m Double -> Signal m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals m -> Signal m Double
forall (m :: * -> *). ResultPredefinedSignals m -> Signal m Double
resultSignalInIntegTimes ResultPredefinedSignals m
rs)
pureResultSignal ResultPredefinedSignals m
rs (ResultSignal Signal m ()
s) =
  Signal m Double -> Signal m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals m -> Signal m Double
forall (m :: * -> *). ResultPredefinedSignals m -> Signal m Double
resultSignalInStartTime ResultPredefinedSignals m
rs) Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m Double -> Signal m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals m -> Signal m Double
forall (m :: * -> *). ResultPredefinedSignals m -> Signal m Double
resultSignalInStopTime ResultPredefinedSignals m
rs) Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m ()
s
pureResultSignal ResultPredefinedSignals m
rs (ResultSignalMix Signal m ()
s) =
  Signal m Double -> Signal m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals m -> Signal m Double
forall (m :: * -> *). ResultPredefinedSignals m -> Signal m Double
resultSignalInIntegTimes ResultPredefinedSignals m
rs) Signal m () -> Signal m () -> Signal m ()
forall a. Semigroup a => a -> a -> a
<> Signal m ()
s

-- | Represents a computation that can return the simulation data.
class MonadDES m => ResultComputing t m where

  -- | Compute data with the results of simulation.
  computeResultData :: t m a -> ResultData a m

  -- | Return the signal triggered when data change if such a signal exists.
  computeResultSignal :: t m a -> ResultSignal m

-- | Return a new result value by the specified name, identifier and computation.
computeResultValue :: ResultComputing t m
                      => ResultName
                      -- ^ the result name
                      -> [ResultName]
                      -- ^ the result name path
                      -> ResultId
                      -- ^ the result identifier
                      -> [ResultId]
                      -- ^ the result identifier path
                      -> t m a
                      -- ^ the result computation
                      -> ResultValue a m
computeResultValue :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> t m a
-> ResultValue a m
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is t m a
m =
  ResultValue :: forall e (m :: * -> *).
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultData e m
-> ResultSignal m
-> ResultValue e m
ResultValue {
    resultValueName :: ResultName
resultValueName   = ResultName
name,
    resultValueNamePath :: [ResultName]
resultValueNamePath = [ResultName]
names,
    resultValueId :: ResultId
resultValueId     = ResultId
i,
    resultValueIdPath :: [ResultId]
resultValueIdPath = [ResultId]
is,
    resultValueData :: ResultData a m
resultValueData   = t m a -> ResultData a m
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ResultComputing t m =>
t m a -> ResultData a m
computeResultData t m a
m,
    resultValueSignal :: ResultSignal m
resultValueSignal = t m a -> ResultSignal m
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ResultComputing t m =>
t m a -> ResultSignal m
computeResultSignal t m a
m }

instance MonadDES m => ResultComputing Parameter m where

  computeResultData :: Parameter m a -> ResultData a m
computeResultData = Parameter m a -> ResultData a m
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter
  computeResultSignal :: Parameter m a -> ResultSignal m
computeResultSignal = ResultSignal m -> Parameter m a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal

instance MonadDES m => ResultComputing Simulation m where

  computeResultData :: Simulation m a -> ResultData a m
computeResultData = Simulation m a -> ResultData a m
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
SimulationLift t m =>
Simulation m a -> t m a
liftSimulation
  computeResultSignal :: Simulation m a -> ResultSignal m
computeResultSignal = ResultSignal m -> Simulation m a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal

instance MonadDES m => ResultComputing Dynamics m where

  computeResultData :: Dynamics m a -> ResultData a m
computeResultData = Dynamics m a -> ResultData a m
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics
  computeResultSignal :: Dynamics m a -> ResultSignal m
computeResultSignal = ResultSignal m -> Dynamics m a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal

instance MonadDES m => ResultComputing Event m where

  computeResultData :: Event m a -> Event m a
computeResultData = Event m a -> Event m a
forall a. a -> a
id
  computeResultSignal :: Event m a -> ResultSignal m
computeResultSignal = ResultSignal m -> Event m a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal

instance MonadDES m => ResultComputing Ref m where

  computeResultData :: Ref m a -> ResultData a m
computeResultData = Ref m a -> ResultData a m
forall (m :: * -> *) a. MonadDES m => Ref m a -> Event m a
readRef
  computeResultSignal :: Ref m a -> ResultSignal m
computeResultSignal = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignal (Signal m () -> ResultSignal m)
-> (Ref m a -> Signal m ()) -> Ref m a -> ResultSignal m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ref m a -> Signal m ()
forall (m :: * -> *) a. MonadDES m => Ref m a -> Signal m ()
refChanged_

instance MonadDES m => ResultComputing B.Ref m where

  computeResultData :: Ref m a -> ResultData a m
computeResultData = Ref m a -> ResultData a m
forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
B.readRef
  computeResultSignal :: Ref m a -> ResultSignal m
computeResultSignal = ResultSignal m -> Ref m a -> ResultSignal m
forall a b. a -> b -> a
const ResultSignal m
forall (m :: * -> *). ResultSignal m
UnknownResultSignal

instance MonadVar m => ResultComputing Var m where

  computeResultData :: Var m a -> ResultData a m
computeResultData = Var m a -> ResultData a m
forall (m :: * -> *) a. MonadVar m => Var m a -> ResultData a m
readVar
  computeResultSignal :: Var m a -> ResultSignal m
computeResultSignal = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignal (Signal m () -> ResultSignal m)
-> (Var m a -> Signal m ()) -> Var m a -> ResultSignal m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Var m a -> Signal m ()
forall (m :: * -> *) a.
(MonadVar m, MonadDES m) =>
Var m a -> Signal m ()
varChanged_

instance MonadDES m => ResultComputing Signalable m where

  computeResultData :: Signalable m a -> ResultData a m
computeResultData = Signalable m a -> ResultData a m
forall (m :: * -> *) a. Signalable m a -> Event m a
readSignalable
  computeResultSignal :: Signalable m a -> ResultSignal m
computeResultSignal = Signal m () -> ResultSignal m
forall (m :: * -> *). Signal m () -> ResultSignal m
ResultSignal (Signal m () -> ResultSignal m)
-> (Signalable m a -> Signal m ())
-> Signalable m a
-> ResultSignal m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Signalable m a -> Signal m ()
forall (m :: * -> *) a. Signalable m a -> Signal m ()
signalableChanged_
      
-- | Return a source by the specified statistics.
samplingStatsResultSource :: (MonadDES m,
                              ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultValue (SamplingStats a) m
                             -- ^ the statistics
                             -> ResultSource m
samplingStatsResultSource :: ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSource ResultValue (SamplingStats a) m
x =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (SamplingStats a) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue (SamplingStats a) m
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (SamplingStats a) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue (SamplingStats a) m
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingStatsId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal    = ResultValue (SamplingStats a) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue (SamplingStats a) m
x,
    resultObjectSummary :: ResultSource m
resultObjectSummary   = ResultValue (SamplingStats a) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSummary ResultValue (SamplingStats a) m
x,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> Int)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"count" ResultId
SamplingStatsCountId SamplingStats a -> Int
forall a. SamplingStats a -> Int
samplingStatsCount,
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"mean" ResultId
SamplingStatsMeanId SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsMean,
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"mean2" ResultId
SamplingStatsMean2Id SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsMean2,
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"std" ResultId
SamplingStatsDeviationId SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsDeviation,
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"var" ResultId
SamplingStatsVarianceId SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsVariance,
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"min" ResultId
SamplingStatsMinId SamplingStats a -> a
forall a. SamplingStats a -> a
samplingStatsMin,
      ResultContainer (ResultData (SamplingStats a) m) m
-> ResultName
-> ResultId
-> (SamplingStats a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a) m) m
c ResultName
"max" ResultId
SamplingStatsMaxId SamplingStats a -> a
forall a. SamplingStats a -> a
samplingStatsMax ] }
  where
    c :: ResultContainer (ResultData (SamplingStats a) m) m
c = ResultValue (SamplingStats a) m
-> ResultContainer (ResultData (SamplingStats a) m) m
forall a (m :: * -> *).
ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue (SamplingStats a) m
x

-- | Return the summary by the specified statistics.
samplingStatsResultSummary :: (MonadDES m,
                               ResultItemable (ResultValue (SamplingStats a)))
                              => ResultValue (SamplingStats a) m
                              -- ^ the statistics
                              -> ResultSource m
samplingStatsResultSummary :: ResultValue (SamplingStats a) m -> ResultSource m
samplingStatsResultSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue (SamplingStats a) m -> ResultItem m)
-> ResultValue (SamplingStats a) m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue ResultName m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem (ResultValue ResultName m -> ResultItem m)
-> (ResultValue (SamplingStats a) m -> ResultValue ResultName m)
-> ResultValue (SamplingStats a) m
-> ResultItem m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue (SamplingStats a) m -> ResultValue ResultName m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue ResultName m
resultItemToStringValue 
  
-- | Return a source by the specified timing statistics.
timingStatsResultSource :: (MonadDES m,
                            TimingData a,
                            ResultItemable (ResultValue a),
                            ResultItemable (ResultValue (TimingStats a)))
                           => ResultValue (TimingStats a) m
                           -- ^ the statistics
                           -> ResultSource m
timingStatsResultSource :: ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSource ResultValue (TimingStats a) m
x =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (TimingStats a) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue (TimingStats a) m
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (TimingStats a) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue (TimingStats a) m
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingStatsId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal    = ResultValue (TimingStats a) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue (TimingStats a) m
x,
    resultObjectSummary :: ResultSource m
resultObjectSummary   = ResultValue (TimingStats a) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, TimingData a,
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSummary ResultValue (TimingStats a) m
x,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Int)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"count" ResultId
TimingStatsCountId TimingStats a -> Int
forall a. TimingStats a -> Int
timingStatsCount,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"mean" ResultId
TimingStatsMeanId TimingStats a -> Double
forall a. TimingData a => TimingStats a -> Double
timingStatsMean,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"std" ResultId
TimingStatsDeviationId TimingStats a -> Double
forall a. TimingData a => TimingStats a -> Double
timingStatsDeviation,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"var" ResultId
TimingStatsVarianceId TimingStats a -> Double
forall a. TimingData a => TimingStats a -> Double
timingStatsVariance,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"min" ResultId
TimingStatsMinId TimingStats a -> a
forall a. TimingStats a -> a
timingStatsMin,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"max" ResultId
TimingStatsMaxId TimingStats a -> a
forall a. TimingStats a -> a
timingStatsMax,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"minTime" ResultId
TimingStatsMinTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsMinTime,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"maxTime" ResultId
TimingStatsMaxTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsMaxTime,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"startTime" ResultId
TimingStatsStartTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsStartTime,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"lastTime" ResultId
TimingStatsLastTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsLastTime,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"sum" ResultId
TimingStatsSumId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsSum,
      ResultContainer (ResultData (TimingStats a) m) m
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingStats a) m) m
c ResultName
"sum2" ResultId
TimingStatsSum2Id TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsSum2 ] }
  where
    c :: ResultContainer (ResultData (TimingStats a) m) m
c = ResultValue (TimingStats a) m
-> ResultContainer (ResultData (TimingStats a) m) m
forall a (m :: * -> *).
ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue (TimingStats a) m
x

-- | Return the summary by the specified timing statistics.
timingStatsResultSummary :: (MonadDES m,
                             TimingData a,
                             ResultItemable (ResultValue (TimingStats a)))
                            => ResultValue (TimingStats a) m 
                            -- ^ the statistics
                            -> ResultSource m
timingStatsResultSummary :: ResultValue (TimingStats a) m -> ResultSource m
timingStatsResultSummary = ResultItem m -> ResultSource m
forall (m :: * -> *). ResultItem m -> ResultSource m
ResultItemSource (ResultItem m -> ResultSource m)
-> (ResultValue (TimingStats a) m -> ResultItem m)
-> ResultValue (TimingStats a) m
-> ResultSource m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue ResultName m -> ResultItem m
forall (m :: * -> *) (a :: (* -> *) -> *).
ResultItemable a =>
a m -> ResultItem m
ResultItem (ResultValue ResultName m -> ResultItem m)
-> (ResultValue (TimingStats a) m -> ResultValue ResultName m)
-> ResultValue (TimingStats a) m
-> ResultItem m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue (TimingStats a) m -> ResultValue ResultName m
forall (m :: * -> *) (a :: (* -> *) -> *).
(MonadDES m, ResultItemable a) =>
a m -> ResultValue ResultName m
resultItemToStringValue
  
-- | Return a source by the specified counter.
samplingCounterResultSource :: (MonadDES m,
                                ResultItemable (ResultValue a),
                                ResultItemable (ResultValue (SamplingStats a)))
                               => ResultValue (SamplingCounter a) m
                               -- ^ the counter
                               -> ResultSource m
samplingCounterResultSource :: ResultValue (SamplingCounter a) m -> ResultSource m
samplingCounterResultSource ResultValue (SamplingCounter a) m
x =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (SamplingCounter a) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue (SamplingCounter a) m
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (SamplingCounter a) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue (SamplingCounter a) m
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingCounterId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal    = ResultValue (SamplingCounter a) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue (SamplingCounter a) m
x,
    resultObjectSummary :: ResultSource m
resultObjectSummary   = ResultValue (SamplingCounter a) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) m -> ResultSource m
samplingCounterResultSummary ResultValue (SamplingCounter a) m
x,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (ResultData (SamplingCounter a) m) m
-> ResultName
-> ResultId
-> (SamplingCounter a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a) m) m
c ResultName
"value" ResultId
SamplingCounterValueId SamplingCounter a -> a
forall a. SamplingCounter a -> a
samplingCounterValue,
      ResultContainer (ResultData (SamplingCounter a) m) m
-> ResultName
-> ResultId
-> (SamplingCounter a -> SamplingStats a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a) m) m
c ResultName
"stats" ResultId
SamplingCounterStatsId SamplingCounter a -> SamplingStats a
forall a. SamplingCounter a -> SamplingStats a
samplingCounterStats ] }
  where
    c :: ResultContainer (ResultData (SamplingCounter a) m) m
c = ResultValue (SamplingCounter a) m
-> ResultContainer (ResultData (SamplingCounter a) m) m
forall a (m :: * -> *).
ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue (SamplingCounter a) m
x
      
-- | Return a source by the specified counter.
samplingCounterResultSummary :: (MonadDES m,
                                 ResultItemable (ResultValue a),
                                 ResultItemable (ResultValue (SamplingStats a)))
                                => ResultValue (SamplingCounter a) m
                                -- ^ the counter
                                -> ResultSource m
samplingCounterResultSummary :: ResultValue (SamplingCounter a) m -> ResultSource m
samplingCounterResultSummary ResultValue (SamplingCounter a) m
x =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (SamplingCounter a) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue (SamplingCounter a) m
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (SamplingCounter a) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue (SamplingCounter a) m
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingCounterId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal    = ResultValue (SamplingCounter a) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue (SamplingCounter a) m
x,
    resultObjectSummary :: ResultSource m
resultObjectSummary   = ResultValue (SamplingCounter a) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) m -> ResultSource m
samplingCounterResultSummary ResultValue (SamplingCounter a) m
x,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (ResultData (SamplingCounter a) m) m
-> ResultName
-> ResultId
-> (SamplingCounter a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a) m) m
c ResultName
"value" ResultId
SamplingCounterValueId SamplingCounter a -> a
forall a. SamplingCounter a -> a
samplingCounterValue,
      ResultContainer (ResultData (SamplingCounter a) m) m
-> ResultName
-> ResultId
-> (SamplingCounter a -> SamplingStats a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a) m) m
c ResultName
"stats" ResultId
SamplingCounterStatsId SamplingCounter a -> SamplingStats a
forall a. SamplingCounter a -> SamplingStats a
samplingCounterStats ] }
  where
    c :: ResultContainer (ResultData (SamplingCounter a) m) m
c = ResultValue (SamplingCounter a) m
-> ResultContainer (ResultData (SamplingCounter a) m) m
forall a (m :: * -> *).
ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue (SamplingCounter a) m
x
      
-- | Return a source by the specified counter.
timingCounterResultSource :: (MonadDES m,
                              ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultValue (TimingCounter a) m
                             -- ^ the counter
                             -> ResultSource m
timingCounterResultSource :: ResultValue (TimingCounter a) m -> ResultSource m
timingCounterResultSource ResultValue (TimingCounter a) m
x =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (TimingCounter a) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue (TimingCounter a) m
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (TimingCounter a) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue (TimingCounter a) m
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingCounterId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal    = ResultValue (TimingCounter a) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue (TimingCounter a) m
x,
    resultObjectSummary :: ResultSource m
resultObjectSummary   = ResultValue (TimingCounter a) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) m -> ResultSource m
timingCounterResultSummary ResultValue (TimingCounter a) m
x,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (ResultData (TimingCounter a) m) m
-> ResultName
-> ResultId
-> (TimingCounter a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a) m) m
c ResultName
"value" ResultId
TimingCounterValueId TimingCounter a -> a
forall a. TimingCounter a -> a
timingCounterValue,
      ResultContainer (ResultData (TimingCounter a) m) m
-> ResultName
-> ResultId
-> (TimingCounter a -> TimingStats a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a) m) m
c ResultName
"stats" ResultId
TimingCounterStatsId TimingCounter a -> TimingStats a
forall a. TimingCounter a -> TimingStats a
timingCounterStats ] }
  where
    c :: ResultContainer (ResultData (TimingCounter a) m) m
c = ResultValue (TimingCounter a) m
-> ResultContainer (ResultData (TimingCounter a) m) m
forall a (m :: * -> *).
ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue (TimingCounter a) m
x
      
-- | Return a source by the specified counter.
timingCounterResultSummary :: (MonadDES m,
                               ResultItemable (ResultValue a),
                               ResultItemable (ResultValue (TimingStats a)))
                              => ResultValue (TimingCounter a) m
                              -- ^ the counter
                              -> ResultSource m
timingCounterResultSummary :: ResultValue (TimingCounter a) m -> ResultSource m
timingCounterResultSummary ResultValue (TimingCounter a) m
x =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (TimingCounter a) m -> ResultName
forall e (m :: * -> *). ResultValue e m -> ResultName
resultValueName ResultValue (TimingCounter a) m
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (TimingCounter a) m -> ResultId
forall e (m :: * -> *). ResultValue e m -> ResultId
resultValueId ResultValue (TimingCounter a) m
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingCounterId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal    = ResultValue (TimingCounter a) m -> ResultSignal m
forall e (m :: * -> *). ResultValue e m -> ResultSignal m
resultValueSignal ResultValue (TimingCounter a) m
x,
    resultObjectSummary :: ResultSource m
resultObjectSummary   = ResultValue (TimingCounter a) m -> ResultSource m
forall (m :: * -> *) a.
(MonadDES m, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) m -> ResultSource m
timingCounterResultSummary ResultValue (TimingCounter a) m
x,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (ResultData (TimingCounter a) m) m
-> ResultName
-> ResultId
-> (TimingCounter a -> a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a) m) m
c ResultName
"value" ResultId
TimingCounterValueId TimingCounter a -> a
forall a. TimingCounter a -> a
timingCounterValue,
      ResultContainer (ResultData (TimingCounter a) m) m
-> ResultName
-> ResultId
-> (TimingCounter a -> TimingStats a)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer (ResultData a m) m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a) m) m
c ResultName
"stats" ResultId
TimingCounterStatsId TimingCounter a -> TimingStats a
forall a. TimingCounter a -> TimingStats a
timingCounterStats ] }
  where
    c :: ResultContainer (ResultData (TimingCounter a) m) m
c = ResultValue (TimingCounter a) m
-> ResultContainer (ResultData (TimingCounter a) m) m
forall a (m :: * -> *).
ResultValue a m -> ResultContainer (ResultData a m) m
resultValueToContainer ResultValue (TimingCounter a) m
x
  
-- | Return a source by the specified finite queue.
queueResultSource :: (MonadDES m,
                      Show si, Show sm, Show so,
                      ResultItemable (ResultValue si),
                      ResultItemable (ResultValue sm),
                      ResultItemable (ResultValue so))
                     => ResultContainer (Q.Queue m si sm so a) m
                     -- ^ the queue container
                     -> ResultSource m
queueResultSource :: ResultContainer (Queue m si sm so a) m -> ResultSource m
queueResultSource ResultContainer (Queue m si sm so a) m
c =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Queue m si sm so a) m -> ResultName
forall e (m :: * -> *). ResultContainer e m -> ResultName
resultContainerName ResultContainer (Queue m si sm so a) m
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Queue m si sm so a) m -> ResultId
forall e (m :: * -> *). ResultContainer e m -> ResultId
resultContainerId ResultContainer (Queue m si sm so a) m
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal = ResultContainer (Queue m si sm so a) m -> ResultSignal m
forall e (m :: * -> *). ResultContainer e m -> ResultSignal m
resultContainerSignal ResultContainer (Queue m si sm so a) m
c,
    resultObjectSummary :: ResultSource m
resultObjectSummary = ResultContainer (Queue m si sm so a) m -> ResultSource m
forall (m :: * -> *) si sm so a.
(MonadDES m, Show si, Show sm, Show so) =>
ResultContainer (Queue m si sm so a) m -> ResultSource m
queueResultSummary ResultContainer (Queue m si sm so a) m
c,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> si)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerConstProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueStrategy" ResultId
EnqueueStrategyId Queue m si sm so a -> si
forall (m :: * -> *) si sm so a. Queue m si sm so a -> si
Q.enqueueStrategy,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> sm)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerConstProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueStoringStrategy" ResultId
EnqueueStoringStrategyId Queue m si sm so a -> sm
forall (m :: * -> *) si sm so a. Queue m si sm so a -> sm
Q.enqueueStoringStrategy,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> so)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerConstProperty ResultContainer (Queue m si sm so a) m
c ResultName
"dequeueStrategy" ResultId
DequeueStrategyId Queue m si sm so a -> so
forall (m :: * -> *) si sm so a. Queue m si sm so a -> so
Q.dequeueStrategy,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Bool)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueNull" ResultId
QueueNullId Queue m si sm so a -> Event m Bool
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Bool
Q.queueNull Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueNullChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Bool)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueFull" ResultId
QueueFullId Queue m si sm so a -> Event m Bool
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Bool
Q.queueFull Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueFullChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Int)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerConstProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueMaxCount" ResultId
QueueMaxCountId Queue m si sm so a -> Int
forall (m :: * -> *) si sm so a. Queue m si sm so a -> Int
Q.queueMaxCount,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Int)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueCount" ResultId
QueueCountId Queue m si sm so a -> Event m Int
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Int
Q.queueCount Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m (TimingStats Int))
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueCountStats" ResultId
QueueCountStatsId Queue m si sm so a -> Event m (TimingStats Int)
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m (TimingStats Int)
Q.queueCountStats Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Int)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueCount" ResultId
EnqueueCountId Queue m si sm so a -> Event m Int
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Int
Q.enqueueCount Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.enqueueCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Int)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueLostCount" ResultId
EnqueueLostCountId Queue m si sm so a -> Event m Int
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Int
Q.enqueueLostCount Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.enqueueLostCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Int)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueStoreCount" ResultId
EnqueueStoreCountId Queue m si sm so a -> Event m Int
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Int
Q.enqueueStoreCount Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.enqueueStoreCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Int)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"dequeueCount" ResultId
DequeueCountId Queue m si sm so a -> Event m Int
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Int
Q.dequeueCount Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.dequeueCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Int)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"dequeueExtractCount" ResultId
DequeueExtractCountId Queue m si sm so a -> Event m Int
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Int
Q.dequeueExtractCount Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.dequeueExtractCountChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Double)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueLoadFactor" ResultId
QueueLoadFactorId Queue m si sm so a -> Event m Double
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Double
Q.queueLoadFactor Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueLoadFactorChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> Event m b) -> ResultProperty m
resultContainerIntegProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueRate" ResultId
EnqueueRateId Queue m si sm so a -> Event m Double
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Double
Q.enqueueRate,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> Event m b) -> ResultProperty m
resultContainerIntegProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueStoreRate" ResultId
EnqueueStoreRateId Queue m si sm so a -> Event m Double
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Double
Q.enqueueStoreRate,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> Event m b) -> ResultProperty m
resultContainerIntegProperty ResultContainer (Queue m si sm so a) m
c ResultName
"dequeueRate" ResultId
DequeueRateId Queue m si sm so a -> Event m Double
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Double
Q.dequeueRate,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Double)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> Event m b) -> ResultProperty m
resultContainerIntegProperty ResultContainer (Queue m si sm so a) m
c ResultName
"dequeueExtractRate" ResultId
DequeueExtractRateId Queue m si sm so a -> Event m Double
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Double
Q.dequeueExtractRate,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m (SamplingStats Double))
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueWaitTime" ResultId
QueueWaitTimeId Queue m si sm so a -> Event m (SamplingStats Double)
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m (SamplingStats Double)
Q.queueWaitTime Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueWaitTimeChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m (SamplingStats Double))
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueTotalWaitTime" ResultId
QueueTotalWaitTimeId Queue m si sm so a -> Event m (SamplingStats Double)
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m (SamplingStats Double)
Q.queueTotalWaitTime Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueTotalWaitTimeChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m (SamplingStats Double))
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"enqueueWaitTime" ResultId
EnqueueWaitTimeId Queue m si sm so a -> Event m (SamplingStats Double)
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m (SamplingStats Double)
Q.enqueueWaitTime Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.enqueueWaitTimeChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m (SamplingStats Double))
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"dequeueWaitTime" ResultId
DequeueWaitTimeId Queue m si sm so a -> Event m (SamplingStats Double)
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m (SamplingStats Double)
Q.dequeueWaitTime Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.dequeueWaitTimeChanged_,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m Double)
-> (Queue m si sm so a -> Signal m ())
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName
-> ResultId
-> (a -> Event m b)
-> (a -> Signal m ())
-> ResultProperty m
resultContainerProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueRate" ResultId
QueueRateId Queue m si sm so a -> Event m Double
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Event m Double
Q.queueRate Queue m si sm so a -> Signal m ()
forall (m :: * -> *) si sm so a.
MonadDES m =>
Queue m si sm so a -> Signal m ()
Q.queueRateChanged_ ] }

-- | Return the summary by the specified finite queue.
queueResultSummary :: (MonadDES m,
                       Show si, Show sm, Show so)
                      => ResultContainer (Q.Queue m si sm so a) m
                      -- ^ the queue container
                      -> ResultSource m
queueResultSummary :: ResultContainer (Queue m si sm so a) m -> ResultSource m
queueResultSummary ResultContainer (Queue m si sm so a) m
c =
  ResultObject m -> ResultSource m
forall (m :: * -> *). ResultObject m -> ResultSource m
ResultObjectSource (ResultObject m -> ResultSource m)
-> ResultObject m -> ResultSource m
forall a b. (a -> b) -> a -> b
$
  ResultObject :: forall (m :: * -> *).
ResultName
-> ResultId
-> ResultId
-> [ResultProperty m]
-> ResultSignal m
-> ResultSource m
-> ResultObject m
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Queue m si sm so a) m -> ResultName
forall e (m :: * -> *). ResultContainer e m -> ResultName
resultContainerName ResultContainer (Queue m si sm so a) m
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Queue m si sm so a) m -> ResultId
forall e (m :: * -> *). ResultContainer e m -> ResultId
resultContainerId ResultContainer (Queue m si sm so a) m
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal m
resultObjectSignal = ResultContainer (Queue m si sm so a) m -> ResultSignal m
forall e (m :: * -> *). ResultContainer e m -> ResultSignal m
resultContainerSignal ResultContainer (Queue m si sm so a) m
c,
    resultObjectSummary :: ResultSource m
resultObjectSummary = ResultContainer (Queue m si sm so a) m -> ResultSource m
forall (m :: * -> *) si sm so a.
(MonadDES m, Show si, Show sm, Show so) =>
ResultContainer (Queue m si sm so a) m -> ResultSource m
queueResultSummary ResultContainer (Queue m si sm so a) m
c,
    resultObjectProperties :: [ResultProperty m]
resultObjectProperties = [
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Int)
-> ResultProperty m
forall (m :: * -> *) b a.
(MonadDES m, ResultItemable (ResultValue b)) =>
ResultContainer a m
-> ResultName -> ResultId -> (a -> b) -> ResultProperty m
resultContainerConstProperty ResultContainer (Queue m si sm so a) m
c ResultName
"queueMaxCount" ResultId
QueueMaxCountId Queue m si sm so a -> Int
forall (m :: * -> *) si sm so a. Queue m si sm so a -> Int
Q.queueMaxCount,
      ResultContainer (Queue m si sm so a) m
-> ResultName
-> ResultId
-> (Queue m si sm so a -> Event m (TimingStats Int)