Hi,
I got a Constraint that references a single Expression max and an Expression can be referenced by a single Constraint. So there is a one-to-one relationship between Expression and Constraint. Expression has a constraint reference to Constraint whose opposite is expression. How can I automatically update the opposite, when I don’t use FMMultiValueLink ? Do I need to do it by myself programmatically?
Thanks in advance for your help.
Anne
Hi,
You cannot use FM*Link, because it is not a many-to-one/many relation. Just do it like that (replace more or less package by expression and message by constraint in the following code snippet):
Class A: package <MSEProperty: #package type: #Package opposite: #message> <MSEComment: package corresponding to this message'>
^ package
package: new | old | old := package. (old = new) ifFalse: [
old ifNotNil: [ package := nil. "temporarily, to avoid infinite recursion" old message: nil ]. package := new. new ifNotNil: [new message: self] ]
Class B: message <MSEProperty: #message type: #Message opposite: #package> <MSEComment: 'A possible Message corresponding to this package'>
^ self privateState attributeAt: #message ifAbsent: nil
message: new | old | old := self privateState attributeAt: #message ifAbsent: nil. (old = new) ifFalse: [ old ifNotNil: [ self privateState attributeAt: #message put: nil. "temporarily, to avoid infinite recursion" old package: nil ]. self privateState attributeAt: #message put: new. new ifNotNil: [ new package: self] ]
Vincent
-----Message d'origine----- De : moose-dev-bounces@list.inf.unibe.ch [mailto:moose-dev- bounces@list.inf.unibe.ch] De la part de Anne Etien Envoyé : lundi 4 avril 2016 16:22 À : Moose-related development Objet : [Moose-dev] Creating opposite in case of 1:1 Association
Hi,
I got a Constraint that references a single Expression max and an Expression can be referenced by a single Constraint. So there is a one-to-one relationship between Expression and Constraint. Expression has a constraint reference to Constraint whose opposite is expression. How can I automatically update the opposite, when I don’t use FMMultiValueLink ? Do I need to do it by myself programmatically?
Thanks in advance for your help.
Anne
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
!!!************************************************************************************* "Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!"