All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class collections.LinkedBuffer

java.lang.Object
   |
   +----collections.UpdatableImpl
           |
           +----collections.UpdatableBagImpl
                   |
                   +----collections.LinkedBuffer

public class LinkedBuffer
extends UpdatableBagImpl
implements UpdatableBag
Linked Buffer implementation of Bags. The Bag consists of any number of buffers holding elements, arranged in a list. Each buffer holds an array of elements. The size of each buffer is the value of chunkSize that was current during the operation that caused the Bag to grow. The chunkSize() may be adjusted at any time. (It is not considered a version change.)

All but the final buffer is always kept full. When a buffer has no elements, it is released (so is available for garbage collection).

LinkedBuffers are good choices for collections in which you merely put a lot of things in, and then look at them via enumerations, but don't often look for particular elements.


Variable Index

 o chunkSize_
The chunk size to use for making next buffer
 o defaultChunkSize
The default chunk size to use for buffers
 o lastCount_
The number of elements of the tail node actually used.
 o tail_
The last node of the circular list of chunks.

Constructor Index

 o LinkedBuffer()
Make an empty buffer.
 o LinkedBuffer(Predicate)
Make an empty buffer, using the supplied element screener.
 o LinkedBuffer(Predicate, int, CLCell, int, int)
Special version of constructor needed by clone()

Method Index

 o add(Object)
Implements collections.UpdatableBag.add.
 o addIfAbsent(Object)
Implements collections.UpdatableBag.addIfAbsent.
 o checkImplementation()
Implements collections.ImplementationCheckable.checkImplementation.
 o chunkSize()
Report the chunk size used when adding new buffers to the list
 o chunkSize(int)
Set the chunk size to be used when adding new buffers to the list during future add() operations.
 o clear()
Implements collections.UpdatableCollection.clear.
 o clone()
Make an independent copy.
 o elements()
Implements collections.Collection.elements.
 o exclude(Object)
Implements collections.UpdatableCollection.exclude.
 o includes(Object)
Implements collections.Collection.includes.
 o occurrencesOf(Object)
Implements collections.Collection.occurrencesOf.
 o removeOneOf(Object)
Implements collections.UpdatableCollection.removeOneOf.
 o replaceAllOf(Object, Object)
Implements collections.UpdatableCollection.replaceAllOf.
 o replaceOneOf(Object, Object)
Implements collections.UpdatableCollection.replaceOneOf Time complexity: O(n).
 o take()
Implements collections.UpdatableCollection.take.

Variables

 o defaultChunkSize
 public static final int defaultChunkSize
The default chunk size to use for buffers

 o tail_
 protected CLCell tail_
The last node of the circular list of chunks. Null if empty.

 o lastCount_
 protected int lastCount_
The number of elements of the tail node actually used. (all others are kept full).

 o chunkSize_
 protected int chunkSize_
The chunk size to use for making next buffer

Constructors

 o LinkedBuffer
 public LinkedBuffer()
Make an empty buffer.

 o LinkedBuffer
 public LinkedBuffer(Predicate s)
Make an empty buffer, using the supplied element screener.

 o LinkedBuffer
 protected LinkedBuffer(Predicate s,
                        int n,
                        CLCell t,
                        int lc,
                        int cs)
Special version of constructor needed by clone()

Methods

 o clone
 protected Object clone() throws CloneNotSupportedException
Make an independent copy. Does not clone elements.

Overrides:
clone in class Object
 o chunkSize
 public synchronized int chunkSize()
Report the chunk size used when adding new buffers to the list

 o chunkSize
 public synchronized void chunkSize(int newChunkSize) throws IllegalArgumentException
Set the chunk size to be used when adding new buffers to the list during future add() operations. Any value greater than 0 is OK. (A value of 1 makes this a into very slow simulation of a linked list!)

 o includes
 public synchronized boolean includes(Object element)
Implements collections.Collection.includes. Time complexity: O(n).

Overrides:
includes in class UpdatableImpl
See Also:
includes
 o occurrencesOf
 public synchronized int occurrencesOf(Object element)
Implements collections.Collection.occurrencesOf. Time complexity: O(n).

Overrides:
occurrencesOf in class UpdatableImpl
See Also:
occurrencesOf
 o elements
 public synchronized CollectionEnumeration elements()
Implements collections.Collection.elements. Time complexity: O(1).

Overrides:
elements in class UpdatableImpl
See Also:
elements
 o clear
 public synchronized void clear()
Implements collections.UpdatableCollection.clear. Time complexity: O(1).

Overrides:
clear in class UpdatableImpl
See Also:
clear
 o exclude
 public synchronized void exclude(Object element)
Implements collections.UpdatableCollection.exclude. Time complexity: O(n).

Overrides:
exclude in class UpdatableImpl
See Also:
exclude
 o removeOneOf
 public synchronized void removeOneOf(Object element)
Implements collections.UpdatableCollection.removeOneOf. Time complexity: O(n).

Overrides:
removeOneOf in class UpdatableImpl
See Also:
removeOneOf
 o replaceOneOf
 public synchronized void replaceOneOf(Object oldElement,
                                       Object newElement) throws IllegalElementException
Implements collections.UpdatableCollection.replaceOneOf Time complexity: O(n).

Overrides:
replaceOneOf in class UpdatableImpl
See Also:
replaceOneOf
 o replaceAllOf
 public synchronized void replaceAllOf(Object oldElement,
                                       Object newElement) throws IllegalElementException
Implements collections.UpdatableCollection.replaceAllOf. Time complexity: O(n).

Overrides:
replaceAllOf in class UpdatableImpl
See Also:
replaceAllOf
 o take
 public synchronized Object take() throws NoSuchElementException
Implements collections.UpdatableCollection.take. Time complexity: O(1). Takes the least element.

Overrides:
take in class UpdatableImpl
See Also:
take
 o addIfAbsent
 public synchronized void addIfAbsent(Object element) throws IllegalElementException
Implements collections.UpdatableBag.addIfAbsent. Time complexity: O(n).

Overrides:
addIfAbsent in class UpdatableBagImpl
See Also:
addIfAbsent
 o add
 public synchronized void add(Object element) throws IllegalElementException
Implements collections.UpdatableBag.add. Time complexity: O(1).

Overrides:
add in class UpdatableBagImpl
See Also:
add
 o checkImplementation
 public void checkImplementation() throws ImplementationError
Implements collections.ImplementationCheckable.checkImplementation.

Overrides:
checkImplementation in class UpdatableImpl
See Also:
checkImplementation

All Packages  Class Hierarchy  This Package  Previous  Next  Index