Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="blockGraph"></param>
        /// <param name="next"></param>
        /// <returns></returns>
        private async Task RemoveBlockGraph(BlockGraph blockGraph, Block next)
        {
            _pooledBlockGraphs.Remove(blockGraph);
            var removed = await _unitOfWork.BlockGraphRepository.RemoveAsync(blockGraph.ToIdentifier());

            if (!removed)
            {
                _logger.Here()
                .Error(
                    "Unable to remove the block graph for block - Hash: {@Hash} Round: {@Round} from node {@Node}",
                    next.Hash, next.Round, next.Node);
            }
        }
Example #2
0
        private static void Test1()
        {
            var List = new PooledList <int>(1);

            for (int I = 1; I <= 16; I++)
            {
                List.Add(I);
            }

            List.Remove(1);

            List.Add(2);

            List.Remove(9);

            List.Add(69);

            foreach (var x in List)
            {
                Console.WriteLine(x);
            }
        }
        public void IndexOf_DefaultValue(IndexOfMethod indexOfMethod, int count, bool frontToBackOrder)
        {
            T defaultValue          = default;
            PooledList <T>  list    = GenericListFactory(count);
            IndexOfDelegate IndexOf = IndexOfDelegateFromType(indexOfMethod);

            while (list.Remove(defaultValue))
            {
                count--;
            }
            list.Add(defaultValue);
            Assert.Equal(count, IndexOf(list, defaultValue));

            list.Dispose();
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public VerifyResult Remove(TransactionModel transaction)
        {
            Guard.Argument(transaction, nameof(transaction)).NotNull();
            var removed = false;

            try
            {
                removed = _pooledTransactions.Remove(transaction);
            }
            catch (Exception ex)
            {
                _logger.Here().Error(ex, "Unable to remove transaction with {@TxnId}", transaction.TxnId);
            }

            return(removed ? VerifyResult.Succeed : VerifyResult.Invalid);
        }
        public void BinarySearch_ForEveryItemWithoutDuplicates(int count)
        {
            PooledList <T> list = GenericListFactory(count);

            foreach (T item in list)
            {
                while (list.Count((value) => value.Equals(item)) > 1)
                {
                    list.Remove(item);
                }
            }
            list.Sort();
            PooledList <T> beforeList = list.ToPooledList();

            Assert.All(Enumerable.Range(0, list.Count), index =>
            {
                Assert.Equal(index, list.BinarySearch(beforeList[index]));
                Assert.Equal(index, list.BinarySearch(beforeList[index], GetIComparer()));
                Assert.Equal(beforeList[index], list[index]);
            });
            list.Dispose();
        }
Example #6
0
 /// <summary>
 /// Removes a child from the <see cref="Children"/> collection.
 /// </summary>
 /// <param name="child">The child to remove.</param>
 public void RemoveChild(IVisualNode child)
 {
     EnsureChildrenCreated();
     _children.Remove(child);
 }