|
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.Object dk.rode.thesis.observer.ProbeSequenceObserver
@Participant(value="ConcreteObserver") public class ProbeSequenceObserver
A probe sequence observer prints the internal attributes that
has changed for a given sequence
since the last time
the observer was notified about that sequence, based on equality
using equals(Object)
(and hashCode()
).
Implementation notes:
A probe observer uses the Executor
annotation to specify
the observer methods, and can thus be used with the ObserverManager
type or any AnnotatedObserversSequence
implementation. It cannot,
however, be used an observer for sequences expecting a
SequenceObserver
type.
Field Summary | |
---|---|
private Map<Sequence<?>,Sequence<?>> |
sequences
The map of currently probed sequences. |
Constructor Summary | |
---|---|
ProbeSequenceObserver()
No-arg constructor. |
Method Summary | |
---|---|
(package private) static void |
externalProbe(Sequence<?> sequence,
Sequence.State state)
Probe method that will only be invoked by an observable ReversiblePrimeSequence instance (decorated by
the AnnotatedObserversSequenceDecorator type). |
(package private) void |
internalProbe(Sequence<?> sequence,
Sequence.State state)
Probes the sequence supplied as sequence , and logs
all attributes that has changed value (based on equals(Object) )
since the last time this method was invoked with the same
sequence (based on equals(Object) ) as the first argument. |
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 Map<Sequence<?>,Sequence<?>> sequences
Never null.
Constructor Detail |
---|
public ProbeSequenceObserver()
Method Detail |
---|
@Executor(value=ReversiblePrimeSequence.class) static void externalProbe(Sequence<?> sequence, Sequence.State state)
ReversiblePrimeSequence
instance (decorated by
the AnnotatedObserversSequenceDecorator
type).
sequence
- The sequence; never null.state
- The sequence state; never null.@Executor void internalProbe(Sequence<?> sequence, Sequence.State state) throws Exception
sequence
, and logs
all attributes that has changed value (based on equals(Object)
)
since the last time this method was invoked with the same
sequence (based on equals(Object)
) as the first argument. Any context may use this probe method.
sequence
- The sequence to probe; cannot be null.state
- The current state of sequence
; can be null.
Exception
- If the probing fails.public String toString()
toString
in class Object
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |