|
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.BirthdayRegistry.RegistryObserver<A>
A
- The type of aspect used in the notification. The actual value
is ignored.private final class BirthdayRegistry.RegistryObserver<A>
A registry observer forwards call to the enclosing
registry.
hashCode
and equals
are overridden to
ensure that the same registry is not added twice to
a given observable sequence.
Implementation notes:
This is an application of the Adapter
pattern, in effect adapting a BirthdayRegistry
to
the SequenceObserver
interface.
Constructor Summary | |
---|---|
private |
BirthdayRegistry.RegistryObserver()
No-arg constructor. |
Method Summary | |
---|---|
boolean |
equals(Object object)
Returns true if object is a registry
observer wrapping the same registry as this
observer, false if not. |
int |
hashCode()
Returns the hash code of this observer. |
private BirthdayRegistry |
registry()
Returns the enclosing birthday registry for this observer. |
void |
sequenceEvent(Sequence<?> sequence,
A aspect)
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, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
private BirthdayRegistry.RegistryObserver()
Method Detail |
---|
public boolean equals(Object object)
object
is a registry
observer wrapping the same registry as this
observer, false if not.
equals
in class Object
object
- The object to test; can be null.
public int hashCode()
hashCode
in class Object
private final BirthdayRegistry registry()
public void sequenceEvent(Sequence<?> sequence, A aspect)
SequenceObserver
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.
sequenceEvent
in interface SequenceObserver<A>
sequence
- This sequence; cannot be null.aspect
- The current (new) aspect; cannot be null.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 |