Пример #1
0
        public RemoveResult Remove(Position position, Planet planet)
        {
            var key = new AltViewRowKey(planet.RatingDelta, position);

            var initialDelta = GetCurrentMinDelta();
            var removed      = _storage.Remove(key);
            var currentDelta = GetCurrentMinDelta();

            return(new RemoveResult
            {
                InitialMinDelta = initialDelta,
                Removed = removed,
                CurrentMinDelta = currentDelta,
            });
        }
Пример #2
0
        public AddResult Add(Position position, Planet planet)
        {
            var key = new AltViewRowKey(planet.RatingDelta, position);

            var initialDelta = GetCurrentMinDelta();

            _storage.Add(key);
            if (_storage.Count > _capacity)
            {
                var max = _storage.Max;
                _storage.Remove(max);
            }

            var currentDelta = GetCurrentMinDelta();

            return(new AddResult
            {
                InitialMinDelta = initialDelta,
                CurrentMinDelta = currentDelta.Value
            });
        }