|
||||||||||
| 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.ModelIterator
class ModelList.ModelIterator
The iterator class for ModelList. Package private instead of private so that it can be extended. The methods of this class constitute the only public interface for traversing and modifying ModelList objects (other than insertFront). These iterators support concurrent modification from within the same thread. They are NOT thread safe.
| Field Summary | |
|---|---|
private ModelList.Node<T> |
_point
|
private int |
_pos
|
| Constructor Summary | |
|---|---|
ModelList.ModelIterator()
Standard constructor that creates an iterator pointing to the list head (_head) and adds it the listeners. |
|
ModelList.ModelIterator(ModelList.ModelIterator iter)
Copy constructor that creates a copy of an existing iterator and adds it to the listeners. |
|
| Method Summary | |
|---|---|
boolean |
atEnd()
Return true if we're pointing at the tail. |
boolean |
atFirstItem()
Return true if we're pointing at the node after the head. |
boolean |
atLastItem()
Return true if we're pointing at the node before the tail. |
boolean |
atStart()
Return true if we're pointing at the head. |
void |
collapse(ModelList.ModelIterator iter)
Delete all nodes between the current position of this and the current position of the given iterator. |
ModelList.ModelIterator |
copy()
|
T |
current()
Return the item associated with the current node. |
void |
dispose()
Disposes of an iterator by removing it from the listeners. |
boolean |
eq(ModelList.ModelIterator that)
Tests "that" for equality with "this". |
void |
insert(T item)
Inserts an item before the current item. |
void |
next()
Moves to the next node. |
T |
nextItem()
Returns the item associated with the node after the current node. |
private void |
notifyOfCollapse(int leftPos,
int rightPos,
ModelList.Node<T> rightPoint)
Notifies the iterators in _listeners that a range of nodes has been collapsed. |
private void |
notifyOfInsert(int pos)
Notifies the iterators in _listeners that a node has been inserted. |
private void |
notifyOfRemove(int pos,
ModelList.Node<T> point)
Notifies the iterators in _listeners that a node has been removed. |
int |
pos()
|
void |
prev()
Moves to the previous node. |
T |
prevItem()
Returns the item associated with the node before the current node. |
void |
remove()
Removes the current item from the list. |
void |
setTo(ModelList.ModelIterator that)
Force "this" iterator to take the values of "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> _point
private int _pos
| Constructor Detail |
|---|
public ModelList.ModelIterator()
public ModelList.ModelIterator(ModelList.ModelIterator iter)
| Method Detail |
|---|
public ModelList.ModelIterator copy()
public boolean eq(ModelList.ModelIterator that)
public void setTo(ModelList.ModelIterator that)
public void dispose()
public boolean atStart()
public boolean atEnd()
public boolean atFirstItem()
public boolean atLastItem()
public T current()
public T prevItem()
public T nextItem()
public int pos()
public void insert(T item)
public void remove()
public void prev()
public void next()
public void collapse(ModelList.ModelIterator iter)
private void notifyOfInsert(int pos)
private void notifyOfRemove(int pos,
ModelList.Node<T> point)
private void notifyOfCollapse(int leftPos,
int rightPos,
ModelList.Node<T> rightPoint)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||