コード例 #1
0
        /// <summary>
        /// Removes order by id
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns>Removal result.</returns>
        public bool RemoveOrder(ulong orderId)
        {
            var order = orderMap.GetOrder(orderId);

            if (order == null)
            {
                return(false);
            }
            if (Head == order)
            {
                Head = order.Next;
            }
            if (Tail == order)
            {
                Tail = order.Prev;
            }
            if (order.Prev != null)
            {
                order.Prev.Next = order.Next;
            }
            if (order.Next != null)
            {
                order.Next.Prev = order.Prev;
            }

            orderMap.RemoveOrder(orderId);
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Removes order by id
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns>Removal result.</returns>
        public bool RemoveOrder(ulong orderId)
        {
            var order = orderMap.GetOrder(orderId);

            if (order == null)
            {
                return(false);
            }
            if (Head == order)
            {
                Head = order.Next;
            }
            if (Tail == order)
            {
                Tail = order.Prev;
            }
            if (order.Prev != null)
            {
                order.Prev.Next = order.Next;
            }
            if (order.Next != null)
            {
                order.Next.Prev = order.Prev;
            }

            orderMap.RemoveOrder(orderId);

            var index = sortedOrders.BinarySearch(order, comparer);

            sortedOrders.RemoveAt(index);

            return(true);
        }