Exemple #1
0
 public Reporter(QueueWithLimit <T> queue, Producer <T> producer, Consumer <T> consumer,
                 ReportMode mode = ReportMode.verbose)
 {
     _queue        = queue;
     _producer     = producer;
     _consumer     = consumer;
     _mode         = mode;
     _goodBalances = 0;
     _badBalances  = 0;
 }
        /// <summary>
        /// Sets up a scenario with a single participant
        /// of each type.
        /// </summary>
        public Scenario(int queueLimit, int initialElements, int iterations,
                        int producerDelay, int consumerDelay, Reporter <Data> .ReportMode mode)
        {
            _queue    = new QueueWithLimit <Data>(queueLimit, initialElements);
            _producer = new Producer <Data>(_queue);
            _consumer = new Consumer <Data>(_queue);
            _reporter = new Reporter <Data>(_queue, _producer, _consumer, mode);

            _iterations    = iterations;
            _producerDelay = producerDelay;
            _consumerDelay = consumerDelay;
        }