Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] empty Sequence
[ATL] empty Sequence [message #535136] Fri, 21 May 2010 08:22 Go to next message
Eclipse UserFriend
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 08:46 Go to previous messageGo to next message
Eclipse UserFriend
You can use a ->flatten()
Re: [ATL] empty Sequence [message #535171 is a reply to message #535136] Fri, 21 May 2010 09:25 Go to previous message
Eclipse UserFriend
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: Fri May 23 17:01:52 EDT 2025

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

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

Back to the top