|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.gt.data.FastLinkedList<E>
E
- The element type of this linked list.public class FastLinkedList<E>
A linked list that provides efficient add and removal functions.
Red (tfeng) |
Yellow (tfeng) |
Nested Class Summary | |
---|---|
class |
FastLinkedList.Entry
An entry in this linked list that contains an element. |
Field Summary | |
---|---|
private FastLinkedList.Entry |
_head
The head of this linked list. |
private boolean |
_recalculateSize
Whether the _size field is an inaccurate size of this linked list. |
private int |
_size
The size of this linked list. |
private FastLinkedList.Entry |
_tail
The tail of this linked list. |
Constructor Summary | |
---|---|
FastLinkedList()
|
Method Summary | ||
---|---|---|
boolean |
add(E element)
Add an element to the end of this linked list. |
|
boolean |
addAll(java.util.Collection<? extends E> collection)
Add all the elements of the given collection to the end of this linked list. |
|
void |
addEntryAfter(FastLinkedList.Entry entry,
FastLinkedList.Entry previousEntry)
Add an entry after previousEntry, or add the entry to the head if previousEntry is null. |
|
void |
addEntryBefore(FastLinkedList.Entry entry,
FastLinkedList.Entry nextEntry)
Add an entry before nextEntry, or add the entry to the tail if nextEntry is null. |
|
void |
addEntryToHead(FastLinkedList.Entry entry)
Add an entry to the head of this linked list. |
|
void |
addEntryToTail(FastLinkedList.Entry entry)
Add an entry to the tail of this linked list. |
|
void |
clear()
Clear this linked list. |
|
boolean |
contains(java.lang.Object element)
Test whether this linked list has the given element in an entry. |
|
boolean |
containsAll(java.util.Collection<?> collection)
Test whether this linked list has all the elements of the given collection. |
|
FastLinkedList.Entry |
findEntry(E element)
Find an entry with the given element and return it. |
|
FastLinkedList.Entry |
getHead()
Get the head entry. |
|
FastLinkedList.Entry |
getTail()
Get the tail entry. |
|
boolean |
isEmpty()
Test whether this collection is empty. |
|
java.util.Iterator<E> |
iterator()
Not implemented. |
|
boolean |
remove(java.lang.Object element)
Remove the first entry that has the given element. |
|
boolean |
removeAll(java.util.Collection<?> collection)
Remove all the elements of the collection from this linked list. |
|
boolean |
removeAllAfter(FastLinkedList.Entry entry)
Remove all entries after the given entry. |
|
boolean |
removeAllBefore(FastLinkedList.Entry entry)
Remove all entries before the given entry. |
|
boolean |
retainAll(java.util.Collection<?> collection)
Retain all elements of the given collection, but remove entries whose elements are not in the collection. |
|
int |
size()
Get the size of this linked list. |
|
java.lang.Object[] |
toArray()
Return an array that contains all the elements in this linked list. |
|
|
toArray(T[] array)
Store all the elements in this linked list into the given array if its size is enough for the storage, or create a new array of the same type as the given array for the storage and return it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Field Detail |
---|
private FastLinkedList.Entry _head
private boolean _recalculateSize
private int _size
private FastLinkedList.Entry _tail
Constructor Detail |
---|
public FastLinkedList()
Method Detail |
---|
public boolean add(E element)
add
in interface java.util.Collection<E>
element
- The element to be added.
public boolean addAll(java.util.Collection<? extends E> collection)
addAll
in interface java.util.Collection<E>
collection
- The collection.
public void addEntryAfter(FastLinkedList.Entry entry, FastLinkedList.Entry previousEntry)
entry
- The entry to be added.previousEntry
- The previous entry.public void addEntryBefore(FastLinkedList.Entry entry, FastLinkedList.Entry nextEntry)
entry
- The entry to be added.nextEntry
- The next entry.public void addEntryToHead(FastLinkedList.Entry entry)
entry
- The entry to be added.public void addEntryToTail(FastLinkedList.Entry entry)
entry
- The entry to be added.public void clear()
clear
in interface java.util.Collection<E>
public boolean contains(java.lang.Object element)
contains
in interface java.util.Collection<E>
element
- The element.
public boolean containsAll(java.util.Collection<?> collection)
containsAll
in interface java.util.Collection<E>
collection
- The collection.
public FastLinkedList.Entry findEntry(E element)
element
- The element.
public FastLinkedList.Entry getHead()
public FastLinkedList.Entry getTail()
public boolean isEmpty()
isEmpty
in interface java.util.Collection<E>
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
public boolean remove(java.lang.Object element)
remove
in interface java.util.Collection<E>
element
- The element.
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<E>
collection
- The collection.
public boolean removeAllAfter(FastLinkedList.Entry entry)
entry
- The entry, which must be contained in this linked list.
public boolean removeAllBefore(FastLinkedList.Entry entry)
entry
- The entry, which must be contained in this linked list.
public boolean retainAll(java.util.Collection<?> collection)
retainAll
in interface java.util.Collection<E>
collection
- The collection.
public int size()
size
in interface java.util.Collection<E>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<E>
public <T> T[] toArray(T[] array)
toArray
in interface java.util.Collection<E>
T
- The element type of the array.array
- The array.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |