|
|
|
Re: Avoiding duplicate link between node. [message #636879 is a reply to message #636848] |
Wed, 03 November 2010 08:33 |
|
Hi,
If I understand you correctly, your B, C , D & E classes have a structure like below:
class B {
private List<X> sourceConnections;
private List<X> targetConnections;
}
Here 'X' would be the model class you use to represent links. Have I understood you correctly?
The problem is since you have allowed 'many' source and target connections on your node B, you are able to connect the same two node multiple times. There are two ways to overcome this problem.
1. You can change your model so that it becomes something like:
class B {
private X sourceConnection;
private X targetConnection;
}
Here we have effectively limited the model so that one object may have only one incoming connection and one outgoing connection.
2. You can add an OCL constraint to your connection mapping. Learn about link constraints from here http://wiki.eclipse.org/index.php/GMF_Constraints#Link_Const raints and may be add two constraints on the source edge and the target edge; inside ocl code just check whether your sourceConnections list / targetConnections list is not empty and return false if so.
Hope this helps.
- Asiri
|
|
|
|
Powered by
FUDForum. Page generated in 0.03202 seconds