Problem with OCL code while comparing the same class attribute of two instances [message #1815895] |
Mon, 14 October 2019 15:24 |
Banafsheh Azizi Messages: 328 Registered: July 2016 |
Senior Member |
|
|
Hi there,
I am using a constraint solver to check constraint satisfiability. The solver takes OCL constraint. I have written a persons2families transformation. Consider the code bellow, in which a Male with the max age is a father.
operation Persons!Male isFather() : Boolean {
for (i in Persons!Male.all())
{
if (self.lastName = i.lastName)
{
if (i.age > self.age)
{
return false;
}
}
}
return true;
}
I pass the conditions in the form of `Type.allInstances()->exists(p|Condition)` which is understandable for the solver. For the `if conditions` above I wonder whether how I can send the logic to solver. Because the type of both sides of operator is the same.
CSP constraint: Male.allInstances.size() <> 0 and Male.allInstances()->exists(p|p.lastName = ?.lastName and p.age>?.age)
Member of MDSE Research Group
http://mdse.ui.ac.ir
|
|
|
|
Powered by
FUDForum. Page generated in 0.03484 seconds