how to implement this observer pattern?
Posted
by lethal
on Stack Overflow
See other posts from Stack Overflow
or by lethal
Published on 2010-03-19T13:11:12Z
Indexed on
2010/03/19
13:21 UTC
Read the original article
Hit count: 189
java
|design-patterns
Hello. I have 4 classes, that describe state diagram. Node, Edge, ComponentOfNode, ComponentOfEdge.
ComponentOfEdge compounds from ComponentsOfNode. Node can have 0..n outgoing edges. Edge can have only 2 nodes.
Edge should be able to offer ComponentOfNode, but only from nodes that Edge has, in form ComponentOfEdge. The user can change ComponentsOfNode. I need this change spreads to all Edge. Hw to do it? I expect the observer should be used. Can you give me example in pseudocode please?
© Stack Overflow or respective owner