Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

Class CorrelatedSequenceObserver

  extended by dk.rode.thesis.observer.CorrelatedSequenceObserver
All Implemented Interfaces:

public class CorrelatedSequenceObserver
extends Object
implements SequenceObserver<Sequence.State>

A correlated sequence observer correlates the behaviour of an observable sequence with another (perhaps observable) Sequence.

When Sequence.next() is invoked on the observed sequence, next is invoked on the correlated sequence. The same is true for Sequence.reset(), either if implicit in form of a bounded sequence that wraps, or because the reset() method was explicitly invoked.

Gunni Rode / rode.dk

Field Summary
private  Sequence<?> sequence
          The correlated sequence.
Constructor Summary
CorrelatedSequenceObserver(Sequence<?> sequence)
Method Summary
 void sequenceEvent(Sequence<?> sequence, Sequence.State state)
          Notification method that is invoked when the sequence supplied as sequence has changed its state to state.
 String toString()
          Returns the string representation of this observer.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


private final Sequence<?> sequence
The correlated sequence.

Never null.

Constructor Detail


public CorrelatedSequenceObserver(Sequence<?> sequence)

sequence - The sequence to correlate; cannot be null.
NullPointerException - If sequence is null.
Method Detail


public void sequenceEvent(Sequence<?> sequence,
                          Sequence.State state)
Description copied from interface: SequenceObserver
Notification method that is invoked when the sequence supplied as sequence has changed its state to state.

The type of sequence is not defined; it cannot be assumed observable, or even of the type this observer was attached to; it might be adapted, decorated, composite, or proxied.

Specified by:
sequenceEvent in interface SequenceObserver<Sequence.State>
sequence - This sequence; cannot be null.
state - The current (new) aspect; cannot be null.


public String toString()
Returns the string representation of this observer.

toString in class Object
The string representation; never null.

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.