public abstract class AbstractCollection extends java.lang.Object implements Collection, Rollbackable
The programmer should provide a no-argument constructor, and one that accepts another Collection, as recommended by the Collection interface. Unfortunately, there is no way to enforce this in Java.
Collection
,
AbstractSet
,
AbstractList
Modifier and Type | Field and Description |
---|---|
protected Checkpoint |
$CHECKPOINT |
protected CheckpointRecord |
$RECORD$$CHECKPOINT |
Modifier | Constructor and Description |
---|---|
protected |
AbstractCollection()
The main constructor, for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes
made at timestamp and afterward.
|
Checkpoint |
$GET$CHECKPOINT()
Get the checkpoint object that monitors this rollbackable object.
|
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable
object.
|
java.lang.Object |
$SET$CHECKPOINT(Checkpoint checkpoint)
Set the checkpoint object of this rollbackable object.
|
boolean |
add(java.lang.Object o)
Add an object to the collection (optional operation).
|
boolean |
addAll(Collection c)
Add all the elements of a given collection to this collection (optional
operation).
|
void |
clear()
Remove all elements from the collection (optional operation).
|
boolean |
contains(java.lang.Object o)
Test whether this collection contains a given object.
|
boolean |
containsAll(Collection c)
Tests whether this collection contains all the elements in a given
collection.
|
boolean |
isEmpty()
Test whether this collection is empty.
|
abstract java.util.Iterator |
iterator()
Return an Iterator over this collection.
|
boolean |
remove(java.lang.Object o)
Remove a single instance of an object from this collection (optional
operation).
|
boolean |
removeAll(Collection c)
Remove from this collection all its elements that are contained in a given
collection (optional operation).
|
boolean |
retainAll(Collection c)
Remove from this collection all its elements that are not contained in a
given collection (optional operation).
|
abstract int |
size()
Return the number of elements in this collection.
|
java.lang.Object[] |
toArray()
Return an array containing the elements of this collection.
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
Copy the collection into a given array if it will fit, or into a
dynamically created array of the same run-time type as the given array if
not.
|
java.lang.String |
toString()
Creates a String representation of the Collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
protected transient Checkpoint $CHECKPOINT
protected transient CheckpointRecord $RECORD$$CHECKPOINT
protected AbstractCollection()
public abstract java.util.Iterator iterator()
iterator
in interface Collection
public abstract int size()
size
in interface Collection
public boolean add(java.lang.Object o)
add
in interface Collection
o
- the object to addjava.lang.UnsupportedOperationException
- if the add operation is not
supported on this collectionjava.lang.NullPointerException
- if the collection does not support nulljava.lang.ClassCastException
- if the object is of the wrong typejava.lang.IllegalArgumentException
- if some aspect of the object prevents
it from being addedpublic boolean addAll(Collection c)
addAll
in interface Collection
c
- the collection to add the elements of to this collectionjava.lang.UnsupportedOperationException
- if the add operation is not
supported on this collectionjava.lang.NullPointerException
- if the specified collection is nulljava.lang.ClassCastException
- if the type of any element in c is
not a valid type for addition.java.lang.IllegalArgumentException
- if some aspect of any element
in c prevents it being added.java.lang.NullPointerException
- if any element in c is null and this
collection doesn't allow null values.add(Object)
public void clear()
clear
in interface Collection
java.lang.UnsupportedOperationException
- if the Iterator returned by
iterator does not provide an implementation of removeIterator.remove()
public boolean contains(java.lang.Object o)
contains
in interface Collection
o
- the object to remove from this collectionpublic boolean containsAll(Collection c)
containsAll
in interface Collection
c
- the collection to test againstjava.lang.NullPointerException
- if the given collection is nullcontains(Object)
public boolean isEmpty()
isEmpty
in interface Collection
size()
public boolean remove(java.lang.Object o)
(o == null ? e == null : o.equals(e))
, if such an element
exists. This implementation obtains an iterator over the collection
and iterates over it, testing each element for equality with the given
object. If it is equal, it is removed by the iterator's remove method
(thus this method will fail with an UnsupportedOperationException if
the Iterator's remove method does). After the first element has been
removed, true is returned; if the end of the collection is reached, false
is returned.remove
in interface Collection
o
- the object to remove from this collectionjava.lang.UnsupportedOperationException
- if this collection's Iterator
does not support the remove methodIterator.remove()
public boolean removeAll(Collection c)
removeAll
in interface Collection
c
- the collection to remove the elements ofjava.lang.UnsupportedOperationException
- if this collection's Iterator
does not support the remove methodjava.lang.NullPointerException
- if the collection, c, is null.Iterator.remove()
public boolean retainAll(Collection c)
retainAll
in interface Collection
c
- the collection to retain the elements ofjava.lang.UnsupportedOperationException
- if this collection's Iterator
does not support the remove methodjava.lang.NullPointerException
- if the collection, c, is null.Iterator.remove()
public java.lang.Object[] toArray()
toArray
in interface Collection
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface Collection
a
- the array to copy into, or of the correct run-time typejava.lang.NullPointerException
- if the given array is nulljava.lang.ArrayStoreException
- if the type of the array precludes holding
one of the elements of the Collectionpublic java.lang.String toString()
toString
in class java.lang.Object
public void $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Rollbackable
$COMMIT
in interface Collection
timestamp
- The timestamp.public void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Rollbackable
$RESTORE
in interface Collection
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
public final Checkpoint $GET$CHECKPOINT()
Rollbackable
$GET$CHECKPOINT
in interface Rollbackable
$GET$CHECKPOINT
in interface Collection
public final java.lang.Object $SET$CHECKPOINT(Checkpoint checkpoint)
Rollbackable
$SET$CHECKPOINT
in interface Rollbackable
$SET$CHECKPOINT
in interface Collection
checkpoint
- The new checkpoint object.Checkpoint.setCheckpoint(Checkpoint)