Package org.multiverse.collections
Class AbstractTxnCollection<E>
- java.lang.Object
-
- org.multiverse.collections.AbstractTxnCollection<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,TxnCollection<E>,TxnIterable<E>
- Direct Known Subclasses:
NaiveTxnHashSet,NaiveTxnLinkedList,NaiveTxnStack
public abstract class AbstractTxnCollection<E> extends java.lang.Object implements TxnCollection<E>
-
-
Field Summary
Fields Modifier and Type Field Description protected TxnRefFactorydefaultRefFactoryprotected Stmstm
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTxnCollection(Stm stm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E item)booleanaddAll(java.util.Collection<? extends E> c)booleanaddAll(TxnCollection<? extends E> c)Adds all of the elements in the specified collection to this collection (optional operation).booleanaddAll(Txn tx, java.util.Collection<? extends E> c)Adds all of the elements in the specified collection to this collection (optional operation).booleanaddAll(Txn tx, TxnCollection<? extends E> c)Adds all of the elements in the specified collection to this collection (optional operation).voidclear()booleancontains(java.lang.Object item)booleancontainsAll(java.util.Collection<?> c)booleancontainsAll(Txn tx, java.util.Collection<?> c)Returns true if this collection contains all of the elements in the specified collection.StmgetStm()Returns the STM that manages this TxnCollection.booleanisEmpty()booleanisEmpty(Txn tx)Returns true if this collection contains no elements.TxnIterator<E>iterator()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()java.lang.Object[]toArray()<T> T[]toArray(T[] a)java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
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
-
-
-
-
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:TxnCollectionReturns the STM that manages this TxnCollection. Returned value will never be null.- Specified by:
getStmin interfaceTxnCollection<E>- Returns:
- the STM that manages this TxnCollection.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<E>
-
isEmpty
public boolean isEmpty(Txn tx)
Description copied from interface:TxnCollectionReturns true if this collection contains no elements.- Specified by:
isEmptyin interfaceTxnCollection<E>- Parameters:
tx- the transaction used for this operation.- Returns:
- true if this collection contains no elements
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<E>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<E>
-
contains
public boolean contains(java.lang.Object item)
- Specified by:
containsin interfacejava.util.Collection<E>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.util.Collection<E>
-
containsAll
public boolean containsAll(Txn tx, java.util.Collection<?> c)
Description copied from interface:TxnCollectionReturns true if this collection contains all of the elements in the specified collection.- Specified by:
containsAllin interfaceTxnCollection<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(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<E>
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
- Specified by:
addAllin interfacejava.util.Collection<E>
-
addAll
public boolean addAll(Txn tx, java.util.Collection<? extends E> c)
Description copied from interface:TxnCollectionAdds 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:
addAllin interfaceTxnCollection<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:TxnCollectionAdds 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:
addAllin interfaceTxnCollection<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:TxnCollectionAdds 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:
addAllin interfaceTxnCollection<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:
iteratorin interfacejava.util.Collection<E>- Specified by:
iteratorin interfacejava.lang.Iterable<E>- Specified by:
iteratorin interfaceTxnIterable<E>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfacejava.util.Collection<E>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<E>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<E>
-
-