org.multiverse.collections
Class AbstractTxnCollection<E>

java.lang.Object
  extended by org.multiverse.collections.AbstractTxnCollection<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, TxnCollection<E>, TxnIterable<E>
Direct Known Subclasses:
NaiveTxnHashSet, NaiveTxnLinkedList, NaiveTxnStack

public abstract class AbstractTxnCollection<E>
extends Object
implements TxnCollection<E>


Field Summary
protected  TxnRefFactory defaultRefFactory
           
protected  Stm stm
           
 
Constructor Summary
protected AbstractTxnCollection(Stm stm)
           
 
Method Summary
 boolean add(E item)
           
 boolean addAll(Collection<? extends E> c)
           
 boolean addAll(TxnCollection<? extends E> c)
          Adds all of the elements in the specified collection to this collection (optional operation).
 boolean addAll(Txn tx, Collection<? extends E> c)
          Adds all of the elements in the specified collection to this collection (optional operation).
 boolean addAll(Txn tx, TxnCollection<? extends E> c)
          Adds all of the elements in the specified collection to this collection (optional operation).
 void clear()
           
 boolean contains(Object item)
           
 boolean containsAll(Collection<?> c)
           
 boolean containsAll(Txn tx, Collection<?> c)
          Returns true if this collection contains all of the elements in the specified collection.
 Stm getStm()
          Returns the STM that manages this TxnCollection.
 boolean isEmpty()
           
 boolean isEmpty(Txn tx)
          Returns true if this collection contains no elements.
 TxnIterator<E> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.multiverse.api.collections.TxnCollection
add, clear, contains, remove, size, toString
 
Methods inherited from interface org.multiverse.api.collections.TxnIterable
iterator
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

stm

protected final Stm stm

defaultRefFactory

protected final TxnRefFactory defaultRefFactory
Constructor Detail

AbstractTxnCollection

protected AbstractTxnCollection(Stm stm)
Method Detail

getStm

public Stm getStm()
Description copied from interface: TxnCollection
Returns the STM that manages this TxnCollection. Returned value will never be null.

Specified by:
getStm in interface TxnCollection<E>
Returns:
the STM that manages this TxnCollection.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>

isEmpty

public boolean isEmpty(Txn tx)
Description copied from interface: TxnCollection
Returns true if this collection contains no elements.

Specified by:
isEmpty in interface TxnCollection<E>
Parameters:
tx - the transaction used for this operation.
Returns:
true if this collection contains no elements

size

public int size()
Specified by:
size in interface Collection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>

contains

public boolean contains(Object item)
Specified by:
contains in interface Collection<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>

containsAll

public boolean containsAll(Txn tx,
                           Collection<?> c)
Description copied from interface: TxnCollection
Returns true if this collection contains all of the elements in the specified collection.

Specified by:
containsAll in interface TxnCollection<E>
Parameters:
tx - the transaction used for this operation.
c - collection to be checked for containment in this collection
Returns:
true if this collection contains all of the elements in the specified collection
See Also:
Collection.contains(Object)

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>

add

public boolean add(E item)
Specified by:
add in interface Collection<E>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>

addAll

public boolean addAll(Txn tx,
                      Collection<? extends E> c)
Description copied from interface: TxnCollection
Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)

Specified by:
addAll in interface TxnCollection<E>
Parameters:
tx - the transaction used for this operation.
c - collection containing elements to be added to this collection
Returns:
true if this collection changed as a result of the call
See Also:
Collection.add(Object)

addAll

public boolean addAll(TxnCollection<? extends E> c)
Description copied from interface: TxnCollection
Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)

Specified by:
addAll in interface TxnCollection<E>
Parameters:
c - collection containing elements to be added to this collection
Returns:
true if this collection changed as a result of the call
See Also:
Collection.add(Object)

addAll

public boolean addAll(Txn tx,
                      TxnCollection<? extends E> c)
Description copied from interface: TxnCollection
Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)

Specified by:
addAll in interface TxnCollection<E>
c - collection containing elements to be added to this collection
Returns:
true if this collection changed as a result of the call
See Also:
Collection.add(Object)

iterator

public TxnIterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface TxnIterable<E>

toString

public String toString()
Overrides:
toString in class Object

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>


Copyright © 2012. All Rights Reserved.