|
|
Re: recursive helper [message #990987 is a reply to message #990761] |
Sun, 16 December 2012 12:31 |
Florian Wieser Messages: 2 Registered: December 2012 |
Junior Member |
|
|
Thx. I have now managed to create an revursive helper
But i have one Problem in the else part. want to store the Sequence elements with the new appended Element in an helper variable.
unfortunately this does not work
helper def: fields: Sequence(FileDefinition!FieldDefinition) =
Sequence{};
helper context GradingSystem!TaskGroup def : getConcreteTasks() : Sequence(FileDefinition!FieldDefinition ) =
self.contains->iterate( child ; elements : Sequence(FileDefinition!FieldDefinition ) =
Sequence{} |
if child.oclIsTypeOf(GradingSystem!TaskGroup) then
(
( elements.union(child.getConcreteTasks()))
)-- TaskGroup : recursive call
else
(
thisModule.fields.union((elements.append(thisModule.NewStaticField(self.name+child.name+'Points', 'Integer'))) )
-- cant store the actual elements sequence in the helper fields, thisModule.field always stays empty
any other possibilities to store this?
) -- ConcreteTask
endif
) -> append(thisModule.NewAgreggField(self.name,'Integer',thisModule.fields )) -- here i would need the thisModule.fields
;
[Updated on: Sun, 16 December 2012 12:32] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03470 seconds