public void VolatileDouble_CanGetAndSetValue()
        {
            var value = new VolatileDouble(1.5);

            value.GetValue().Should().Be(1.5);
            value.SetValue(2.3);
            value.GetValue().Should().Be(2.3);
        }
예제 #2
0
        public void can_get_and_set_value()
        {
            var value = new VolatileDouble(1.5);

            value.GetValue().Should().Be(1.5);
            value.SetValue(2.3);
            value.GetValue().Should().Be(2.3);
        }
        public void VolatileDouble_CanGetAndSetValue()
        {
            var value = new VolatileDouble(1.5);

            value.GetValue().Should().Be(1.5);
            value.SetValue(2.3);
            value.GetValue().Should().Be(2.3);
        }
예제 #4
0
        private void Tick(long count)
        {
            _total.Add(count);
            var instantRate = count / Interval;

            if (_initialized)
            {
                var rate = _m1Rate.GetValue();

                // ReSharper disable ArrangeRedundantParentheses
                _m1Rate.SetValue(rate + (M1Alpha * (instantRate - rate)));

                rate = _m5Rate.GetValue();
                _m5Rate.SetValue(rate + (M5Alpha * (instantRate - rate)));

                rate = _m15Rate.GetValue();
                _m15Rate.SetValue(rate + (M15Alpha * (instantRate - rate)));
                // ReSharper restore ArrangeRedundantParentheses
            }
            else
            {
                _m1Rate.SetValue(instantRate);
                _m5Rate.SetValue(instantRate);
                _m15Rate.SetValue(instantRate);
                _initialized = true;
            }
        }
예제 #5
0
        private void Tick(long count)
        {
            _total.Add(count);
            var instantRate = count / Interval;

            if (_initialized)
            {
                var rate = _m1Rate.GetValue();
                _m1Rate.SetValue(rate + M1Alpha * (instantRate - rate));

                rate = _m5Rate.GetValue();
                _m5Rate.SetValue(rate + M5Alpha * (instantRate - rate));

                rate = _m15Rate.GetValue();
                _m15Rate.SetValue(rate + M15Alpha * (instantRate - rate));
            }
            else
            {
                _m1Rate.SetValue(instantRate);
                _m5Rate.SetValue(instantRate);
                _m15Rate.SetValue(instantRate);
                _initialized = true;
            }
        }