コード例 #1
0
        /// <summary>
        /// Calculates the average number of particles per second since the last call to this method
        /// </summary>
        /// <returns></returns>
        public RadiationSample CalcSample()
        {
            ParticleAccumulator accumulator;

            lock (_lock)
            {
                accumulator  = _accumulator;
                _accumulator = new ParticleAccumulator(_clock);
            }

            // Now calculate the particle counts per second since the last sample was taken
            return(accumulator.CalcSample());
        }
コード例 #2
0
 public RadiationCounter(ITimeProvider clock)
 {
     _lock        = new object();
     _accumulator = new ParticleAccumulator(clock);
     _clock       = clock;
 }