|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.definitions.reducedmodel.ModelList<T>
class ModelList<T>
A doubly-linked list class with header and trailer nodes. Allows multiple iterators to make modifications to the same list without failing unlike the iterators for java.util.*List.
| Nested Class Summary | |
|---|---|
(package private) class |
ModelList.ModelIterator
The iterator class for ModelList. |
private static class |
ModelList.Node<T>
The Node class for ModelLists. |
| Field Summary | |
|---|---|
private ModelList.Node<T> |
_head
|
private int |
_length
length of this list; supports constant time length lookup |
private Set<ModelList.ModelIterator> |
_listeners
a set of objects that can trigger and listen for updates to the list |
private ModelList.Node<T> |
_tail
|
| Constructor Summary | |
|---|---|
ModelList()
Constructor. |
|
| Method Summary | |
|---|---|
private void |
addListener(ModelList.ModelIterator that)
|
ModelList.ModelIterator |
getIterator()
Create a new iterator for this list and register it as one of the listeners which are notified when the list is updated. |
private ModelList.Node<T> |
insert(ModelList.Node<T> point,
T item)
Insert a node immediately before the specified point. |
void |
insertFront(T item)
|
boolean |
isEmpty()
Returns true if the list is empty. |
int |
length()
|
int |
listenerCount()
|
private void |
remove(ModelList.Node<T> point)
Remove a node from the list. |
private void |
removeListener(ModelList.ModelIterator that)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private ModelList.Node<T> _head
private ModelList.Node<T> _tail
private int _length
private Set<ModelList.ModelIterator> _listeners
| Constructor Detail |
|---|
ModelList()
| Method Detail |
|---|
public void insertFront(T item)
private ModelList.Node<T> insert(ModelList.Node<T> point,
T item)
private void remove(ModelList.Node<T> point)
private void addListener(ModelList.ModelIterator that)
private void removeListener(ModelList.ModelIterator that)
public int listenerCount()
public boolean isEmpty()
public int length()
public ModelList.ModelIterator getIterator()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||