示例#1
0
        public void AtomicLongCanBeAssigned()
        {
            AtomicLong x = new AtomicLong(10L);
            AtomicLong y = x;

            y.Value.Should().Be(10L);
        }
示例#2
0
 public UniformReservoir(int size)
 {
     this.values = new AtomicLong[size];
     for (int i = 0; i < values.Length; i++)
     {
         values[i] = new AtomicLong();
     }
 }
示例#3
0
 public void AtomicLongCanBeIncrementedMultipleTimes()
 {
     AtomicLong l = new AtomicLong();
     l.Increment();
     l.Increment();
     l.Increment();
     l.Value.Should().Be(3L);
 }
示例#4
0
        public void AtomicLongCanGetAndSet()
        {
            var num = new AtomicLong();
            num.SetValue(32);
            long val = num.GetAndSet(64);

            val.Should().Be(32);
            num.Value.Should().Be(64);
        }
        public ExponentiallyDecayingReservoir(int size, double alpha, Clock clock, Scheduler scheduler)
        {
            this.size = size;
            this.alpha = alpha;
            this.clock = clock;

            this.rescaleScheduler = scheduler;
            this.rescaleScheduler.Start(RescaleInterval, () => Rescale());

            this.startTime = new AtomicLong(clock.Seconds);
        }
示例#6
0
 public void AtomicLongCanBeDecremented()
 {
     AtomicLong l = new AtomicLong(10L);
     l.Decrement();
     l.Value.Should().Be(9L);
 }
示例#7
0
 public void AtomicLongCanAddValue()
 {
     AtomicLong l = new AtomicLong();
     l.Add(7L);
     l.Value.Should().Be(7L);
 }
示例#8
0
 public void AtomicLongCanBeIncremented()
 {
     AtomicLong l = new AtomicLong();
     l.Increment();
     l.Value.Should().Be(1L);
 }
示例#9
0
 public void AtomicLongCanSetAndReadValue()
 {
     var num = new AtomicLong();
     num.SetValue(32);
     num.Value.Should().Be(32);
 }
示例#10
0
 public void AtomicLong_CanBeDecremented()
 {
     num = new AtomicLong(10L);
     num.Decrement();
     num.Value.Should().Be(9L);
 }