|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdk.rode.thesis.adapter.IteratorSequence<E>
E - The type of values delivered by this iterator.@ParticipantUsage(value="Target",
type=java.util.Iterator.class)
@Participant(value="Adapter")
public class IteratorSequence<E>
An object adapter that adapts a Sequence type
to conform to the Iterator type: when the iterator is
advanced, so is the sequence - hence the adaptation.
IterableSequence,
SequenceIterator| Field Summary | |
|---|---|
private SequenceIterator<E> |
iterator
The adapted sequence in form of an SequenceIterator
instance: the responsibility is designated to the sequence
iterator because it already implements the desired
functionality. |
| Constructor Summary | |
|---|---|
IteratorSequence(Sequence<E> sequence)
Constructor, which creates this iterator sequence to iterate through the sequence value from sequence, starting
from its current value. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
|
E |
next()
|
void |
remove()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final SequenceIterator<E> iterator
SequenceIterator
instance: the responsibility is designated to the sequence
iterator because it already implements the desired
functionality. This makes the adaption easy, as we merely
forward the method invocations. Never null.
| Constructor Detail |
|---|
public IteratorSequence(@Participant(value="Adaptee")
Sequence<E> sequence)
sequence, starting
from its current value.
sequence must be bounded.
sequence - The sequence to adapt as an iterator; cannot be null.
NullPointerException - If sequence is null.
IllegalArgumentException - If sequence is not bounded.| Method Detail |
|---|
public boolean hasNext()
hasNext in interface Iterator<E>public E next()
next in interface Iterator<E>public void remove()
remove in interface Iterator<E>
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||