org.graffiti.util
Class MultiLinkedList<Element extends MultiLinkable<Element,LinkType>,LinkType>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<Element>
              extended by org.graffiti.util.MultiLinkedList<Element,LinkType>
Type Parameters:
Element - The type of the elements contained in the list.
LinkType - The class (typically an enum) that is used to specify which list to use if the element is contained in more than one MultiLinkedList.
All Implemented Interfaces:
Iterable<Element>, Collection<Element>, List<Element>

public class MultiLinkedList<Element extends MultiLinkable<Element,LinkType>,LinkType>
extends AbstractSequentialList<Element>

An doubly linked list implementation of the List interface that performs the remove(Object) operation in constant time. For this to be possible, the contained elements must implement the MultiLinkable interface, i. e. they must provide storage for the linking information. It is also supported that the same element is contained in more than one MultiLinkedLists. Because of that the access to the link nodes is indexed.

Version:
$Revision: 5767 $ $Date: 2009-11-14 17:30:13 +0100 (Sa, 14 Nov 2009) $
Author:
Michael Forster

Constructor Summary
MultiLinkedList(LinkType linkType)
          Creates a new empty list with the given identifier for the link nodes.
 
Method Summary
 void clear()
           
 ListIterator<Element> listIterator(int index)
           
 boolean remove(Object element)
           
 int size()
           
 
Methods inherited from class java.util.AbstractSequentialList
add, addAll, get, iterator, remove, set
 
Methods inherited from class java.util.AbstractList
add, equals, hashCode, indexOf, lastIndexOf, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

MultiLinkedList

public MultiLinkedList(LinkType linkType)
Creates a new empty list with the given identifier for the link nodes.

Parameters:
linkType - The identifier with which the link nodes are indexed in the MultiLinkable.getLinkNode(Object) and MultiLinkable.setLinkNode(Object, MultiLinkNode) methods
Method Detail

clear

public void clear()
Specified by:
clear in interface Collection<Element extends MultiLinkable<Element,LinkType>>
Specified by:
clear in interface List<Element extends MultiLinkable<Element,LinkType>>
Overrides:
clear in class AbstractList<Element extends MultiLinkable<Element,LinkType>>

listIterator

public ListIterator<Element> listIterator(int index)
Specified by:
listIterator in interface List<Element extends MultiLinkable<Element,LinkType>>
Specified by:
listIterator in class AbstractSequentialList<Element extends MultiLinkable<Element,LinkType>>

remove

public boolean remove(Object element)
Specified by:
remove in interface Collection<Element extends MultiLinkable<Element,LinkType>>
Specified by:
remove in interface List<Element extends MultiLinkable<Element,LinkType>>
Overrides:
remove in class AbstractCollection<Element extends MultiLinkable<Element,LinkType>>

size

public int size()
Specified by:
size in interface Collection<Element extends MultiLinkable<Element,LinkType>>
Specified by:
size in interface List<Element extends MultiLinkable<Element,LinkType>>
Specified by:
size in class AbstractCollection<Element extends MultiLinkable<Element,LinkType>>


Generated at 2012-05-30 11:00:14 PM CEST