Class ConcurrentItem

java.lang.Object
  |
  +--ConcurrentItem

public final class ConcurrentItem
extends java.lang.Object

Container class for elements in a concurrent list. Any object even null is allowed to be the content of a ConcurrentItem. Besides the necessary constructors, the only publically available methods can get or set the content of the container.

Version:
0.1, 05/19/03
Author:
Arno Formella and José B. González López

Field Summary
(package private)  boolean deleted
          The flag which indicates whether this item as been removed already by some thread.
(package private)  java.lang.Object element
          The content of this item.
(package private)  int iteratorCounter
          The counter which counts the number of iterators currently holding this item.
(package private)  ConcurrentItem next
          The link to the subsequent item in the list.
(package private)  ConcurrentItem previous
          The link to the previous item in the list.
 
Constructor Summary
  ConcurrentItem()
          Constructs an empty ConcurrentItem.
  ConcurrentItem(java.lang.Object element)
          Constructs a ConcurrentItem containing an object.
(package private) ConcurrentItem(java.lang.Object element, ConcurrentItem next, ConcurrentItem previous)
          Constructs a ConcurrentItem containing an object and two links to the next and previous items in a ConcurrentList.
 
Method Summary
 java.lang.Object getElement()
          Returns the content of the item.
 java.lang.Object setElement(java.lang.Object element)
          Changes the content of the item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

java.lang.Object element
The content of this item.


next

ConcurrentItem next
The link to the subsequent item in the list.


previous

ConcurrentItem previous
The link to the previous item in the list.


deleted

transient boolean deleted
The flag which indicates whether this item as been removed already by some thread.


iteratorCounter

transient int iteratorCounter
The counter which counts the number of iterators currently holding this item.

Constructor Detail

ConcurrentItem

public ConcurrentItem()
Constructs an empty ConcurrentItem. Empty means that the content of the item is null.


ConcurrentItem

public ConcurrentItem(java.lang.Object element)
Constructs a ConcurrentItem containing an object. If null is passed, the item will contain null as content.

Parameters:
element - the element to put as content of the item.

ConcurrentItem

ConcurrentItem(java.lang.Object element,
               ConcurrentItem next,
               ConcurrentItem previous)
Constructs a ConcurrentItem containing an object and two links to the next and previous items in a ConcurrentList. If null is passed, the item will contain null as content.

Parameters:
element - the element to put as content of the item.
next - the item to follow this item in the ConcurrentList.
previous - the item to preceed this item in the ConcurrentList.
Method Detail

setElement

public java.lang.Object setElement(java.lang.Object element)
Changes the content of the item.

Parameters:
element - the element to put as content of the item.
Returns:
the old content of the item.

getElement

public java.lang.Object getElement()
Returns the content of the item.

Returns:
the content of the item.