예제 #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);
 }