    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.

##

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

##

CheckedCollection(UpdatableCollection)
  Wrap collection c in inside a Checker

##

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

##

thys

     public UpdatableCollection thys

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

prev

     public UpdatableCollection prev

  A clone of the thys made before an operation

prevVersion

     public int prevVersion

  The version number of thys before an operation

##

CheckedCollection

     public CheckedCollection(UpdatableCollection c)

  Wrap collection c in inside a Checker

##

clone

     protected Object clone() throws CloneNotSupportedException

  Make a Checked clone of underlying collection

  Overrides:
    clone in class Object

duplicate

     public synchronized Collection duplicate()

  Wrapper for clone()

  See Also:
    clone

postCheck

     protected void postCheck()

  Call at the end of any checked method

preCheck

     protected void preCheck()

  Call at the beginnning of any checked method requiring use of prev clone

canInclude

     public synchronized boolean canInclude(Object element)

  Checks collections.Collection.canInclude according to its specification

  See Also:
    canInclude

isEmpty

     public synchronized boolean isEmpty()

  Checks collections.Collection.isEmpty according to its specification

  See Also:
    isEmpty

size

     public synchronized int size()

  Checks collections.Collection.size according to its specification

  See Also:
    size

occurrencesOf

     public synchronized int occurrencesOf(Object element)

  Checks collections.Collection.occurrencesOf according to its specification

  See Also:
    occurrencesOf

includes

     public synchronized boolean includes(Object element)

  Checks collections.Collection.includes according to its specification

  See Also:
    includes

elements

     public synchronized CollectionEnumeration elements()

  Checks collections.Collection.elements according to its specification

  See Also:
    elements

sameStructure

     public synchronized boolean sameStructure(Collection c)

  Checks collections.Collection.sameStructure according to its specification

  See Also:
    sameStructure

toString

     public String toString()

  Implements Object.toString

  Overrides:
    toString in class Object

version

     public synchronized int version()

  Checks collections.UpdatableCollection.version according to its specification

  See Also:
    version

clear

     public synchronized void clear()

  Checks collections.UpdatableCollection.clear according to its specification

  See Also:
    clear

exclude

     public synchronized void exclude(Object element)

  Checks collections.UpdatableCollection.exclude according to its specification

  See Also:
    exclude

excluding

     public synchronized Collection excluding(Object element)

  Checks collections.Collection.excluding.

  See Also:
    excluding

removeOneOf

     public synchronized void removeOneOf(Object element)

  Checks collections.UpdatableCollection.removeOneOf according to its specification

  See Also:
    removeOneOf

removingOneOf

     public synchronized Collection removingOneOf(Object element)

  Checks collections.Collection.removingOneOf

  See Also:
    removingOneOf

replaceOneOf

     public synchronized void replaceOneOf(Object oldElement,
                                           Object newElement) throws IllegalElementException

  Checks collections.UpdatableCollection.replaceOneOf according to its specification

  See Also:
    replaceOneOf

replacingOneOf

     public synchronized Collection replacingOneOf(Object oldElement,
                                                   Object newElement) throws IllegalElementException

  Checks collections.Collection.replacingOneOf

  See Also:
    replacingOneOf

replaceAllOf

     public synchronized void replaceAllOf(Object oldElement,
                                           Object newElement) throws IllegalElementException

  Checks collections.UpdatableCollection.replaceAllOf according to its specification

  See Also:
    replaceAllOf

replacingAllOf

     public synchronized Collection replacingAllOf(Object oldElement,
                                                   Object newElement) throws IllegalElementException

  Checks collections.Collection.replacingAllOf

  See Also:
    replacingAllOf

take

     public Object take() throws NoSuchElementException

  Checks collections.UpdatableCollection.take according to its specification

  See Also:
    take

excludeElements

     public synchronized void excludeElements(Enumeration e) throws CorruptedEnumerationException

  Checks collections.UpdatableCollection.excludeElements

  See Also:
    excludeElements

removeElements

     public synchronized void removeElements(Enumeration e) throws CorruptedEnumerationException

  Checks collections.UpdatableCollection.removeElements

  See Also:
    removeElements

assert

     public void assert(boolean pred) throws ImplementationError

  Implements collections.ImplementationCheckable.assert.

  See Also:
    assert

checkImplementation

     public synchronized void checkImplementation() throws ImplementationError

  Implements collections.ImplementationCheckable.checkImplementation

  See Also:
    checkImplementation

checkRemove

     protected void checkRemove(Collection nc,
                                Collection oc,
                                Object element,
                                boolean allOccurrences,
                                boolean verchk)

  Helper for checking remov*, exclud*, take

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