[xtend] renameOperation [message #531103] |
Mon, 03 May 2010 13:38  |
Eclipse User |
|
|
|
Hi,
In my previous thread rename class works fine, Now I started with rename Operation transformation on UML model. Which looks more complicated then rename class,
Following is my m2m code in xtend, The problem is commented in the source code.
import uml;
extension templates::helper;
uml::Model root(uml::Model model):
let classlist = model.eAllContents.typeSelect(Class).collect(e|e) :
let operationlist = newList() :
classlist.first().ownedOperation.forAll(o|collectOperations(o, classlist, operationlist)) ->
operationlist.forAll(o|renameOperation((String)o, classlist)) ->
model;
Boolean collectOperations(Operation o, List classlist, List operationlist) :
classlist.forAll(c|((Class)c).ownedOperation.exists(op|op.name == "op1"))
? (// operation found in all classes
// put method in list
operationlist.add(o.name) ->
dump("Added operation '"+o.name+"' to list")
)
: (
dump("Operation '"+o.name+"' exists not in all classes of list")
) ->
true;
// The problem with this renameOperation that xtend does not allow me use classList for owned Operation, How can I handle this
Boolean renameOperation(String o, List classlist) :
classList.ownedOperation.setName("myNewOperation")->
true;
Thanks in advance
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.25421 seconds