org.netbeans.mdr.persistence.btreeimpl.btreestorage
Class IntrusiveList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.AbstractSequentialList
              extended byorg.netbeans.mdr.persistence.btreeimpl.btreestorage.IntrusiveList
All Implemented Interfaces:
java.util.Collection, java.util.List

public class IntrusiveList
extends java.util.AbstractSequentialList
implements java.util.List

A doubly linked list in which the objects contain their pointers. this is used in preference to forte.util.LinkedList since objects can be removed from it in constant time.

Although this implements java.util.List, it has a few restrictions:

  1. Each element in an IntrusiveList must be a subclass of IntrusiveList.Member.
  2. An element can only be a member of one IntrusiveList at a time, and can only appear at one postion in that list.
An IntrusiveList will often be manipulated with its native operations ([add|remove][First|Last]) rather than via the List interface.


Nested Class Summary
static class IntrusiveList.Member
          objects in an intrusive list must inherit from Member
 
Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
IntrusiveList()
          create a new list
 
Method Summary
 void addFirst(IntrusiveList.Member m)
          add an object at the head of the list
 void addLast(IntrusiveList.Member m)
          add an object at the end of the list
 java.util.ListIterator listIterator(int index)
          return a ListIterator
 void remove(IntrusiveList.Member m)
          remove an object from the list
 IntrusiveList.Member removeFirst()
          remove the object at the head of the list
 IntrusiveList.Member removeLast()
          remove the object at the end of the list
 int size()
          return the number of elements in the list
 
Methods inherited from class java.util.AbstractSequentialList
add, addAll, get, iterator, remove, set
 
Methods inherited from class java.util.AbstractList
add, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Constructor Detail

IntrusiveList

public IntrusiveList()
create a new list

Method Detail

addFirst

public void addFirst(IntrusiveList.Member m)
add an object at the head of the list


addLast

public void addLast(IntrusiveList.Member m)
add an object at the end of the list


remove

public void remove(IntrusiveList.Member m)
remove an object from the list


removeFirst

public IntrusiveList.Member removeFirst()
remove the object at the head of the list


removeLast

public IntrusiveList.Member removeLast()
remove the object at the end of the list


size

public int size()
return the number of elements in the list

Specified by:
size in interface java.util.List

listIterator

public java.util.ListIterator listIterator(int index)
return a ListIterator

Specified by:
listIterator in interface java.util.List


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.