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: 169

Filed under:
|

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

Related posts about java

Related posts about design-patterns