Home » Modeling » OCL » Problems with helper...
Problems with helper... [message #547548] |
Sun, 18 July 2010 17:17 |
Roger80 Messages: 79 Registered: May 2010 |
Member |
|
|
Hi all...
Please help me...
I am creating a helper, but I do not work.
I have the following code:
helper context EPK!Event def: isNotEndEvent() : Boolean =
if EPK!Arc.allInstances() -> collect(i | i.source)->includes(self.id) then true
else false
endif;
So, my result is always false.What is my idea behind the rule:
EPK!Arc.allInstances() -> collect(i | i.source)
I take the "source" attribute of all allInstances I have in my source model. As my "source" attributes are something like this "3", I expect as a result a sequence like { "3", "7", "10", "15","20"}
Remark: The source attribute is of type String. Is that correct?
->includes(self.id)
Now I want to check if this result sequence { "3", "7", "10", "15","20"} is an element of the (self.id).
So for every Event this rule is checked and the id are something like { "3"} then {"7"} then {"10"} then {"15"} then {"16"} then {"20"}
My expectation than is that for "3", "7", "10", "15","20" the check is true, but not for "16" as this element is not in the first result sequence. But it doesn't work! What is wrong. Please help me.
2) By the way, how can a I see what is in the sequences, is there a statement to give out the values in a sequence?
Thank you very much for your help! Cheers Roger
includes(self.id)
|
|
|
[ATL] Problems with helper... [message #547562 is a reply to message #547548] |
Sun, 18 July 2010 20:27 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
You may get a better answer on the M2M list with [ATL] in the subject
since it looks like you're using ATL, which uses its own implementation
of OCL that differs from MDT/OCL, so while what you are doing looks
plausible, I am not aware of how ATL implements allInstances or String
equivalence so my answer might be misleading.
Regards
Ed Willink
On 18/07/2010 18:17, Roger80 wrote:
> Hi all...
>
> Please help me...
>
> I am creating a helper, but I do not work.
>
> I have the following code:
>
> helper context EPK!Event def: isNotEndEvent() : Boolean =
> if EPK!Arc.allInstances() -> collect(i | i.source)->includes(self.id)
> then true
> else false
> endif;
>
>
> So, my result is always false.What is my idea behind the rule:
>
> EPK!Arc.allInstances() -> collect(i | i.source)
>
> I take the "source" attribute of all allInstances I have in my source
> model. As my "source" attributes are something like this "3", I expect
> as a result a sequence like { "3", "7", "10", "15","20"}
> Remark: The source attribute is of type String. Is that correct?
>
> ->includes(self.id)
>
> Now I want to check if this result sequence { "3", "7", "10", "15","20"}
> is an element of the (self.id). So for every Event this rule is checked
> and the id are something like { "3"} then {"7"} then {"10"} then {"15"}
> then {"16"} then {"20"}
>
> My expectation than is that for "3", "7", "10", "15","20" the check is
> true, but not for "16" as this element is not in the first result
> sequence. But it doesn't work! What is wrong. Please help me.
>
> 2) By the way, how can a I see what is in the sequences, is there a
> statement to give out the values in a sequence?
>
> Thank you very much for your help! Cheers Roger
>
> includes(self.id)
>
>
|
|
|
Goto Forum:
Current Time: Thu Apr 25 11:57:47 GMT 2024
Powered by FUDForum. Page generated in 0.03461 seconds
|