Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] empty Sequence
[ATL] empty Sequence [message #535136] Fri, 21 May 2010 12:22 Go to next message
graa is currently offline graa
Messages: 42
Registered: April 2010
Member
hi,
i have this sequence i would like to reject all empty sequence
how i can do it?

iniseq=Sequence {Sequence {Sequence {IN2!G1:uml!AbstractGoal}, Sequence {IN2!G2:uml!AbstractGoal}}, Sequence {Sequence {Sequence {IN2!G11:uml!AbstractGoal}, Sequence {IN2!G12:uml!AbstractGoal}}, Sequence {Sequence {IN2!g22:uml!ElementryGoal}, Sequence {IN2!G21:uml!ElementryGoal}}}, Sequence {Sequence {}, Sequence {Sequence {IN2!G121:uml!ElementryGoal}, Sequence {IN2!G122:uml!ElementryGoal}}}, Sequence {Sequence {}, Sequence {}}, Sequence {Sequence {}, Sequence {}}}
thanks

Re: [ATL] empty Sequence [message #535154 is a reply to message #535136] Fri, 21 May 2010 12:46 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 523
Registered: July 2009
Senior Member
You can use a ->flatten()
Re: [ATL] empty Sequence [message #535171 is a reply to message #535136] Fri, 21 May 2010 13:25 Go to previous message
Max Bureck is currently offline Max Bureck
Messages: 72
Registered: July 2009
Member
Here is a helper that should remove all empty sequences recursively:
helper def : removeEmptySequences(seq : Sequence(OclAny)) : Sequence(OclAny) = 
	seq->collect(s | if s.oclIsKindOf(Sequence(OclAny)) then thisModule.removeEmptySequences( s.asSequence() ) else s endif)
	   ->reject( s | if s.oclIsKindOf(Sequence(OclAny)) then s->size() = 0 else false endif );
Previous Topic:Metamodel migration, how to ?
Next Topic:convert sequence
Goto Forum:
  


Current Time: Sat Oct 25 10:31:33 GMT 2014

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

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