views:

186

answers:

2

EDIT: I know it is a little strange design, and so it is difficult to answer. It Is FlowChart diagram on the picture. Every class represents some type of component used in this flowChart. But now I made much more clearer solution of my problem. The question is no more actual.//end EDIT

Hello, I have a small problem which I dont know how to solve. I have three classes, every of them can have many instances. See the picture. alt text

1)InstanceOfClass1 provides array of booleans to instanceOfClass3 going OUT of instanceOfClass1.(see the arrows on the pic)

2)Every other instanceOfClass3 has the identical array of boolean (only in the tree on the picture, there can be more trees in app

3)all booleans in provided array are false.

I need to know how to do this: When I set one boolean in one instanceOfClass3 to true, how to disable setting this one boolean to true in other instances of class 3?

+1  A: 

Not quite clear what you are looking for... I can only guess.

If you are sharing those arrays between your objects, any change you make in the array will be naturally visible in any object which holds a reference to it.

If you do not want the changes to propagate, you must create a separate copy of your array in each object.

Péter Török
Wow, well done on getting the accepted answer to that question. I still don't get what the problem to be solved was.
DaveJohnston
Even so - if that array is in a global state / singleton, I start questioning the design.
Kevin McKelvin
@DaveJohnston Sometimes my wild guess works, with a bit of luck :-) @Kevin McKelvin I agree that there is a lot to be questioned in this design, however the OP seems to have more fundamental problems here...
Péter Török
A: 

This sounds like a poor design. Maybe you should rethink the domain model?

Bryan Rowe