All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class collections.CheckedCollection

java.lang.Object
   |
   +----collections.CheckedCollection

public class CheckedCollection
extends Object
implements UpdatableCollection
Base class for Collection testing. CheckCollections are simple harnesses around other Collections. They include constructors that accept any other kind of collection, c. They mirror each operation in the corresponding interface. For each operation, they invoke c.checkImplementation(), then operate upon c, then check for as many testable effects of the operation as is feasible, and then recheck c.

This is not usually very fast. Among other reasons, checks often require that copies of state be made to compare against later.


Variable Index

 o prev
A clone of the thys made before an operation
 o prevVersion
The version number of thys before an operation
 o thys
The collection performing the actual work.

Constructor Index

 o CheckedCollection(UpdatableCollection)
Wrap collection c in inside a Checker

Method Index

 o assert(boolean)
Implements collections.ImplementationCheckable.assert.
 o canInclude(Object)
Checks collections.Collection.canInclude according to its specification
 o checkImplementation()
Implements collections.ImplementationCheckable.checkImplementation
 o checkRemove(Collection, Collection, Object, boolean, boolean)
Helper for checking remov*, exclud*, take
 o checkReplace(Collection, Collection, Object, Object, boolean, boolean)
Helper for checking replac*
 o clear()
Checks collections.UpdatableCollection.clear according to its specification
 o clone()
Make a Checked clone of underlying collection
 o duplicate()
Wrapper for clone()
 o elements()
Checks collections.Collection.elements according to its specification
 o exclude(Object)
Checks collections.UpdatableCollection.exclude according to its specification
 o excludeElements(Enumeration)
Checks collections.UpdatableCollection.excludeElements
 o excluding(Object)
Checks collections.Collection.excluding.
 o includes(Object)
Checks collections.Collection.includes according to its specification
 o isEmpty()
Checks collections.Collection.isEmpty according to its specification
 o occurrencesOf(Object)
Checks collections.Collection.occurrencesOf according to its specification
 o postCheck()
Call at the end of any checked method
 o preCheck()
Call at the beginnning of any checked method requiring use of prev clone
 o removeElements(Enumeration)
Checks collections.UpdatableCollection.removeElements
 o removeOneOf(Object)
Checks collections.UpdatableCollection.removeOneOf according to its specification
 o removingOneOf(Object)
Checks collections.Collection.removingOneOf
 o replaceAllOf(Object, Object)
Checks collections.UpdatableCollection.replaceAllOf according to its specification
 o replaceOneOf(Object, Object)
Checks collections.UpdatableCollection.replaceOneOf according to its specification
 o replacingAllOf(Object, Object)
Checks collections.Collection.replacingAllOf
 o replacingOneOf(Object, Object)
Checks collections.Collection.replacingOneOf
 o sameStructure(Collection)
Checks collections.Collection.sameStructure according to its specification
 o size()
Checks collections.Collection.size according to its specification
 o take()
Checks collections.UpdatableCollection.take according to its specification
 o toString()
Implements Object.toString
 o version()
Checks collections.UpdatableCollection.version according to its specification

Variables

 o thys
 public UpdatableCollection thys
The collection performing the actual work. (All instance variables are public so can be inspected easily in tests)

 o prev
 public UpdatableCollection prev
A clone of the thys made before an operation

 o prevVersion
 public int prevVersion
The version number of thys before an operation

Constructors

 o CheckedCollection
 public CheckedCollection(UpdatableCollection c)
Wrap collection c in inside a Checker

Methods

 o clone
 protected Object clone() throws CloneNotSupportedException
Make a Checked clone of underlying collection

Overrides:
clone in class Object
 o duplicate
 public synchronized Collection duplicate()
Wrapper for clone()

See Also:
clone
 o postCheck
 protected void postCheck()
Call at the end of any checked method

 o preCheck
 protected void preCheck()
Call at the beginnning of any checked method requiring use of prev clone

 o canInclude
 public synchronized boolean canInclude(Object element)
Checks collections.Collection.canInclude according to its specification

See Also:
canInclude
 o isEmpty
 public synchronized boolean isEmpty()
Checks collections.Collection.isEmpty according to its specification

See Also:
isEmpty
 o size
 public synchronized int size()
Checks collections.Collection.size according to its specification

See Also:
size
 o occurrencesOf
 public synchronized int occurrencesOf(Object element)
Checks collections.Collection.occurrencesOf according to its specification

See Also:
occurrencesOf
 o includes
 public synchronized boolean includes(Object element)
Checks collections.Collection.includes according to its specification

See Also:
includes
 o elements
 public synchronized CollectionEnumeration elements()
Checks collections.Collection.elements according to its specification

See Also:
elements
 o sameStructure
 public synchronized boolean sameStructure(Collection c)
Checks collections.Collection.sameStructure according to its specification

See Also:
sameStructure
 o toString
 public String toString()
Implements Object.toString

Overrides:
toString in class Object
 o version
 public synchronized int version()
Checks collections.UpdatableCollection.version according to its specification

See Also:
version
 o clear
 public synchronized void clear()
Checks collections.UpdatableCollection.clear according to its specification

See Also:
clear
 o exclude
 public synchronized void exclude(Object element)
Checks collections.UpdatableCollection.exclude according to its specification

See Also:
exclude
 o excluding
 public synchronized Collection excluding(Object element)
Checks collections.Collection.excluding.

See Also:
excluding
 o removeOneOf
 public synchronized void removeOneOf(Object element)
Checks collections.UpdatableCollection.removeOneOf according to its specification

See Also:
removeOneOf
 o removingOneOf
 public synchronized Collection removingOneOf(Object element)
Checks collections.Collection.removingOneOf

See Also:
removingOneOf
 o replaceOneOf
 public synchronized void replaceOneOf(Object oldElement,
                                       Object newElement) throws IllegalElementException
Checks collections.UpdatableCollection.replaceOneOf according to its specification

See Also:
replaceOneOf
 o replacingOneOf
 public synchronized Collection replacingOneOf(Object oldElement,
                                               Object newElement) throws IllegalElementException
Checks collections.Collection.replacingOneOf

See Also:
replacingOneOf
 o replaceAllOf
 public synchronized void replaceAllOf(Object oldElement,
                                       Object newElement) throws IllegalElementException
Checks collections.UpdatableCollection.replaceAllOf according to its specification

See Also:
replaceAllOf
 o replacingAllOf
 public synchronized Collection replacingAllOf(Object oldElement,
                                               Object newElement) throws IllegalElementException
Checks collections.Collection.replacingAllOf

See Also:
replacingAllOf
 o take
 public Object take() throws NoSuchElementException
Checks collections.UpdatableCollection.take according to its specification

See Also:
take
 o excludeElements
 public synchronized void excludeElements(Enumeration e) throws CorruptedEnumerationException
Checks collections.UpdatableCollection.excludeElements

See Also:
excludeElements
 o removeElements
 public synchronized void removeElements(Enumeration e) throws CorruptedEnumerationException
Checks collections.UpdatableCollection.removeElements

See Also:
removeElements
 o assert
 public void assert(boolean pred) throws ImplementationError
Implements collections.ImplementationCheckable.assert.

See Also:
assert
 o checkImplementation
 public synchronized void checkImplementation() throws ImplementationError
Implements collections.ImplementationCheckable.checkImplementation

See Also:
checkImplementation
 o checkRemove
 protected void checkRemove(Collection nc,
                            Collection oc,
                            Object element,
                            boolean allOccurrences,
                            boolean verchk)
Helper for checking remov*, exclud*, take

 o checkReplace
 protected void checkReplace(Collection nc,
                             Collection oc,
                             Object oldElement,
                             Object newElement,
                             boolean allOccurrences,
                             boolean verchk)
Helper for checking replac*


All Packages  Class Hierarchy  This Package  Previous  Next  Index