Esempio n. 1
0
        public Linkable popFront()
        {
            Linkable next = tail.next;

            if (next == tail)
            {
                return(null);
            }

            next.unlink();
            return(next);
        }
Esempio n. 2
0
        public void pushFront(Linkable item)
        {
            if (item.previous != null)
            {
                item.unlink();
            }

            item.previous      = tail;
            item.next          = tail.next;
            item.previous.next = item;
            item.next.previous = item;
        }
Esempio n. 3
0
        public void put(long key, Linkable item)
        {
            if (item.previous != null)
            {
                item.unlink();
            }

            Linkable current = entries[(int)(key & size - 1)];

            item.previous      = current.previous;
            item.next          = current;
            item.previous.next = item;
            item.next.previous = item;
            item.id            = key;
        }
Esempio n. 4
0
        public void clear()
        {
            if (tail.next == tail)
            {
                return;
            }

            while (true)
            {
                Linkable next = tail.next;

                if (next == tail)
                {
                    return;
                }

                next.unlink();
            }
        }