Class NaiveTxnLinkedList<E>

    • Constructor Detail

      • NaiveTxnLinkedList

        public NaiveTxnLinkedList​(Stm stm)
      • NaiveTxnLinkedList

        public NaiveTxnLinkedList​(Stm stm,
                                  int capacity)
    • Method Detail

      • set

        public E set​(int index,
                     E element)
        Specified by:
        set in interface TxnList<E>
      • set

        public E set​(Txn tx,
                     int index,
                     E element)
        Specified by:
        set in interface TxnList<E>
      • size

        public int size​(Txn tx)
        Description copied from interface: TxnCollection
        Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Specified by:
        size in interface TxnCollection<E>
        Parameters:
        tx - the transaction used for this operation.
        Returns:
        the number of elements in this collection
      • indexOf

        public int indexOf​(java.lang.Object item)
        Specified by:
        indexOf in interface TxnList<E>
      • indexOf

        public int indexOf​(Txn tx,
                           java.lang.Object item)
        Specified by:
        indexOf in interface TxnList<E>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object item)
        Specified by:
        lastIndexOf in interface TxnList<E>
      • lastIndexOf

        public int lastIndexOf​(Txn tx,
                               java.lang.Object item)
        Specified by:
        lastIndexOf in interface TxnList<E>
      • contains

        public boolean contains​(Txn tx,
                                java.lang.Object o)
        Description copied from interface: TxnCollection
        Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)).
        Specified by:
        contains in interface TxnCollection<E>
        Parameters:
        tx - the transaction used for this operation.
        o - element whose presence in this collection is to be tested
        Returns:
        true if this collection contains the specified element
      • remove

        public boolean remove​(Txn tx,
                              java.lang.Object o)
        Description copied from interface: TxnCollection
        Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).
        Specified by:
        remove in interface TxnCollection<E>
        Parameters:
        tx - the transaction used for this operation.
        o - element to be removed from this collection, if present
        Returns:
        true if an element was removed as a result of this call
      • clear

        public void clear​(Txn tx)
        Description copied from interface: TxnCollection
        Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
        Specified by:
        clear in interface TxnCollection<E>
        Parameters:
        tx - the transaction used for this operation.
      • element

        public E element()
        Specified by:
        element in interface java.util.Deque<E>
        Specified by:
        element in interface java.util.Queue<E>
      • pop

        public E pop()
        Specified by:
        pop in interface java.util.Deque<E>
      • push

        public void push​(E e)
        Specified by:
        push in interface java.util.Deque<E>
      • push

        public void push​(Txn tx,
                         E e)
        Specified by:
        push in interface TxnDeque<E>
      • remove

        public E remove​(int index)
        Specified by:
        remove in interface TxnList<E>
      • remove

        public E remove​(Txn tx,
                        int index)
        Specified by:
        remove in interface TxnList<E>
      • removeFirst

        public E removeFirst()
        Specified by:
        removeFirst in interface java.util.Deque<E>
      • removeLast

        public E removeLast()
        Specified by:
        removeLast in interface java.util.Deque<E>
      • remove

        public E remove()
        Specified by:
        remove in interface java.util.Deque<E>
        Specified by:
        remove in interface java.util.Queue<E>
      • removeFirstOccurrence

        public boolean removeFirstOccurrence​(java.lang.Object o)
        Specified by:
        removeFirstOccurrence in interface java.util.Deque<E>
      • removeLastOccurrence

        public boolean removeLastOccurrence​(java.lang.Object o)
        Specified by:
        removeLastOccurrence in interface java.util.Deque<E>
      • getFirst

        public E getFirst()
        Specified by:
        getFirst in interface java.util.Deque<E>
      • getLast

        public E getLast()
        Specified by:
        getLast in interface java.util.Deque<E>
      • get

        public E get​(int index)
        Specified by:
        get in interface TxnList<E>
      • get

        public E get​(Txn tx,
                     int index)
        Specified by:
        get in interface TxnList<E>
      • addFirst

        public void addFirst​(E e)
        Specified by:
        addFirst in interface java.util.Deque<E>
      • addLast

        public void addLast​(E e)
        Specified by:
        addLast in interface java.util.Deque<E>
      • add

        public boolean add​(Txn tx,
                           E e)
        Description copied from interface: TxnCollection
        Ensures that this collection contains the specified element (optional operation). Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)

        Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.

        If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.

        Specified by:
        add in interface TxnCollection<E>
        Parameters:
        tx - the transaction used for this operation.
        e - element whose presence in this collection is to be ensured
        Returns:
        true if this collection changed as a result of the call
      • putFirst

        public void putFirst​(E item)
        Specified by:
        putFirst in interface TxnDeque<E>
      • put

        public void put​(E item)
        Specified by:
        put in interface TxnQueue<E>
      • put

        public void put​(Txn tx,
                        E item)
        Specified by:
        put in interface TxnQueue<E>
      • putLast

        public void putLast​(E item)
        Specified by:
        putLast in interface TxnDeque<E>
      • putLast

        public void putLast​(Txn tx,
                            E item)
        Specified by:
        putLast in interface TxnDeque<E>
      • take

        public E take()
        Specified by:
        take in interface TxnQueue<E>
      • offerFirst

        public boolean offerFirst​(E e)
        Specified by:
        offerFirst in interface java.util.Deque<E>
      • offerLast

        public boolean offerLast​(E e)
        Specified by:
        offerLast in interface java.util.Deque<E>
      • offerLast

        public boolean offerLast​(Txn tx,
                                 E item)
        Specified by:
        offerLast in interface TxnDeque<E>
      • offer

        public boolean offer​(E item)
        Specified by:
        offer in interface java.util.Deque<E>
        Specified by:
        offer in interface java.util.Queue<E>
      • offer

        public boolean offer​(Txn tx,
                             E item)
        Specified by:
        offer in interface TxnQueue<E>
      • pollFirst

        public E pollFirst()
        Specified by:
        pollFirst in interface java.util.Deque<E>
      • pollLast

        public E pollLast()
        Specified by:
        pollLast in interface java.util.Deque<E>
      • poll

        public E poll()
        Specified by:
        poll in interface java.util.Deque<E>
        Specified by:
        poll in interface java.util.Queue<E>
      • peekFirst

        public E peekFirst()
        Specified by:
        peekFirst in interface java.util.Deque<E>
      • peekLast

        public E peekLast()
        Specified by:
        peekLast in interface java.util.Deque<E>
      • peek

        public E peek()
        Specified by:
        peek in interface java.util.Deque<E>
        Specified by:
        peek in interface java.util.Queue<E>
      • iterator

        public TxnIterator<E> iterator​(Txn tx)
        Description copied from interface: TxnIterable
        Returns an iterator over a set of elements of type T.
        Specified by:
        iterator in interface TxnIterable<E>
        Parameters:
        tx - the Txn used for this Operation.
        Returns:
        an Iterator.
      • descendingIterator

        public TxnIterator<E> descendingIterator()
        Specified by:
        descendingIterator in interface java.util.Deque<E>