Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » How to collect all of the iteration results?
How to collect all of the iteration results? [message #1856334] Sun, 04 December 2022 17:37 Go to next message
Burak Karaduman is currently offline Burak KaradumanFriend
Messages: 84
Registered: July 2018
Member
Dear all,

Considering the below example, I would like to collect all the results of the if/else comparision in the iteration as OrderedSet. However, the iteration only produces the last element's result. Is it possible to capture the results of the each iteration?
helper context OclAny def: IterateEx(obj:P!P):OrderedSet(Boolean)=
	
	
let res: OrderedSet(Boolean) = OrderedSet{} in 
	
res->including(obj.min->iterate(e; travel: Integer = 0 | (if (target<(obj.max->at(obj.min->indexOf(e))))and (target>e)  then
true
      else
false
     endif
    )));

Thank you.

[Updated on: Sun, 04 December 2022 17:39]

Report message to a moderator

Re: How to collect all of the iteration results? [message #1856335 is a reply to message #1856334] Sun, 04 December 2022 18:49 Go to previous message
Burak Karaduman is currently offline Burak KaradumanFriend
Messages: 84
Registered: July 2018
Member
Just use collect instead of iteration.
Previous Topic:Does the regexReplaceAll operation work?
Next Topic:Is it possible to increment and store a variable in helper context declerative part?
Goto Forum:
  


Current Time: Sat Nov 11 08:17:00 GMT 2023

Powered by FUDForum. Page generated in 0.02028 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top