Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » nested loop and remove duplicate sequence(how to execute nested loop and remove the duplicate sequence )
nested loop and remove duplicate sequence [message #1795441] Sat, 22 September 2018 18:15 Go to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 184
Registered: October 2014
Senior Member
Hello ,
I have two problems i need a help on solving them :

First : nested loop
  for (s1 in supp){
                      for (s2 in supp){
                          s1.print()+s2.name.println();
                             
                        }
                 }
         

i want to take s1 and then iterate with every s2 so i want the inner loop to be executed all and when its done go back to take the next s1 again with every s2
Is there any trick to do that ??

Second:
I executed an EOL statement( var result=Vtarget.supplier.flatten().Type) and the result of that statement is a number of sequences as the blows:
Sequence {Class [name=Tcontainer ]}
Sequence {Class [name=TargetParameterType ]}
Sequence {Class [name=Tproperty ]}
Sequence {Class [name=Tproperty]}
My question is how can i remove the duplicate ones for example Sequence {Class [name=Tproperty ]}
i tried to get the result and save it in a set to avoid the duplication but it didn't work. Is there any trick to do that?
Re: nested loop and remove duplicate sequence [message #1795442 is a reply to message #1795441] Sat, 22 September 2018 18:19 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

#1: This is the expected behaviour of the loop you embedded in your message.

#2: Vtarget.supplier.flatten().Type.flatten().asSet() should return a set with no duplicates.

Cheers,
Dimitris

Previous Topic:xsdxml example
Next Topic:Epsilon Book - correction
Goto Forum:
  


Current Time: Thu Apr 25 20:05:27 GMT 2024

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

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

Back to the top