|
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.meta.model.AbstractSequence<E>
dk.rode.thesis.bridge.SequenceAbstraction<E>
dk.rode.thesis.bridge.SynchronisedSequenceAbstraction<E>
E - The type of values delivered by this sequence.@Participant(value="RefinedAbstraction") public class SynchronisedSequenceAbstraction<E>
A synchronised sequence abstraction refines a sequence
abstraction by making it thread-safe.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
|---|
Sequence.State |
| Field Summary |
|---|
| Fields inherited from class dk.rode.thesis.bridge.SequenceAbstraction |
|---|
current, generator |
| Fields inherited from class dk.rode.thesis.meta.model.AbstractSequence |
|---|
state |
| Constructor Summary | |
|---|---|
SynchronisedSequenceAbstraction()
Constructor. |
|
SynchronisedSequenceAbstraction(SequenceAbstraction<E> sequence)
Copy constructor. |
|
SynchronisedSequenceAbstraction(SequenceValueGenerator<? extends E> generator)
Constructor, which creates this synchronised sequence abstraction to use the value generator
supplied as generator. |
|
| Method Summary | |
|---|---|
SynchronisedSequenceAbstraction<E> |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
E |
current()
Returns the current element from this sequence. |
E |
next()
Returns the next element from this sequence. |
void |
reset()
Resets this sequence to start over if it is consistent. |
SequenceAbstraction<E> |
setGenerator(SequenceValueGenerator<? extends E> generator)
Sets the generator to use
for this sequence to generator. |
| Methods inherited from class dk.rode.thesis.bridge.SequenceAbstraction |
|---|
bounded, consistent, isInitialised, state, toString, unique |
| Methods inherited from class dk.rode.thesis.meta.model.AbstractSequence |
|---|
getStringablePolicy, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface dk.rode.thesis.strategy.Stringable |
|---|
getStringablePolicy |
| Constructor Detail |
|---|
public SynchronisedSequenceAbstraction()
A value generator must explicitly
be set using the setGenerator(SequenceValueGenerator)
method before this sequence is valid!
public SynchronisedSequenceAbstraction(SequenceAbstraction<E> sequence)
If sequence does not have a value generator set, a generator must explicitly
be set for this sequence using the
setGenerator(SequenceValueGenerator) method before
this sequence is valid!
sequence - The (synchronised) sequence abstraction to copy;
cannot be null.
NullPointerException - If sequence is null.
public SynchronisedSequenceAbstraction(@Participant(value="Implementation")
SequenceValueGenerator<? extends E> generator)
generator
supplied as generator.
The setGenerator(SequenceValueGenerator) must not
be invoked for this sequence.
generator - The generator to use; cannot be null.
NullPointerException - If generator is null.| Method Detail |
|---|
public SynchronisedSequenceAbstraction<E> copy()
Sequence
copy in interface Sequence<E>copy in interface Copyable<Sequence<E>>copy in class SequenceAbstraction<E>
public E current()
throws IllegalStateException
Sequence
This method can be invoked even if Sequence.next()
has not been invoked yet, thus delivering the initial
value of this sequence.
current in interface Sequence<E>current in class SequenceAbstraction<E>IllegalStateException - If a values has not been set.
public E next()
throws IllegalStateException
Sequence
next in interface Sequence<E>next in class SequenceAbstraction<E>IllegalStateException - If a values has not been set.Sequence.current(),
Sequence.state()
public void reset()
throws IllegalStateException
Sequence
If this sequence is consistent, the
sequence will restart.
reset in interface Sequence<E>reset in class SequenceAbstraction<E>IllegalStateException - If a values has not been set.
public SequenceAbstraction<E> setGenerator(@Participant(value="Implementation")
SequenceValueGenerator<? extends E> generator)
throws IllegalStateException
SequenceAbstractiongenerator to use
for this sequence to generator. A generator can only be set once, and cannot be changed once set. This sequence is not valid until a generator has been set.
setGenerator in class SequenceAbstraction<E>generator - The generator to use; cannot be null.
IllegalStateException - If a generator has already been set.SequenceAbstraction.SequenceAbstraction(SequenceValueGenerator)
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||