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

dk.rode.thesis.observer
Interface ObservableSequence<O,A,E>

Type Parameters:
O - The type of observers.
A - The type of aspect used by this sequence to notify observers.
E - The type of values delivered by this observable sequence.
All Superinterfaces:
Copyable<Sequence<E>>, Observable<O>, Sequence<E>, SequenceObserver<A>, StrictCopyable<Sequence<E>>, Stringable<Sequence<E>>
All Known Subinterfaces:
AspectObservableSequence<O,A,E>
All Known Implementing Classes:
AnnotatedObserversSequence, AnnotatedObserversSequenceDecorator, DateSequence, SequenceObserversSequence, SequenceObserversSequenceDecorator

@Participant(value={"Subject","Observer"})
public interface ObservableSequence<O,A,E>
extends Observable<O>, Sequence<E>, SequenceObserver<A>

An observable sequence is a sequence that allows for observers of the type supplied as the type parameter O to be notified when the sequence changes its aspect. The sequence aspect could for example the its internal state, and the type of aspect is determined by the type parameter A. Observers subscribe to all possible values of the sequence aspect or none.

The notification of observers is performed by invoking the SequenceObserver.sequenceEvent(Sequence, Object) method with this sequence as the first argument and the aspect of this sequence as the second. This will normally be handled by the implementing sequence itself, but how individual observers are notified must be implemented by the sub-class as it is dependent on the type of O.

The order in which observers are notified is undefined.

Implementation notes:
In case the type of observers is the SequenceObserver class ("the default"), the observable sequence in question is will double as an observer as well: observable sequence X can add observable sequence Y as an observer. The structure becomes composite in a depth-first manner because the SequenceObserver.sequenceEvent(Sequence, Object) method can then be used to notify observers and to be notified from other observable sequences.

This interface declares no new methods besides inherited functionality.

Author:
Gunni Rode / rode.dk
See Also:
AspectObservableSequence

Nested Class Summary
 
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence
Sequence.State
 
Method Summary
 
Methods inherited from interface dk.rode.thesis.observer.Observable
addObserver, getObservers, removeObserver
 
Methods inherited from interface dk.rode.thesis.meta.model.Sequence
bounded, consistent, copy, current, next, reset, state, unique
 
Methods inherited from interface dk.rode.thesis.strategy.Stringable
getStringablePolicy, toString
 
Methods inherited from interface dk.rode.thesis.observer.SequenceObserver
sequenceEvent
 


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.