[MOFScript]couldn't print list element [message #384895] |
Fri, 22 August 2008 09:49  |
Eclipse User |
|
|
|
Hello,
I have a class Sca,with one attribute List<String> xxx,I want print all
the elements in this list,I write the following statment in MOFScript.
In the context of Sca,
self.xxx->forEach(s:string)
print(s+",")
when I execute the code (of course ,this is not an empty list),none of the
elements is printed.Does anyone knows what the problem is?
Thanks a lot!
Ye
|
|
|
|
|
|
Re: [MOFScript]couldn't print list element [message #385189 is a reply to message #385188] |
Tue, 26 August 2008 08:05   |
Eclipse User |
|
|
|
Hello,
Well, the problem is still not solved.As I described in my first post,s
means a variable of type String.I think this iteration for string is
right,what do you think?
-------------------------------
I have a class Sca,with one attribute List<String> xxx,I want print all
the elements in this list,I write the following statment in MOFScript:
In the context of Sca,
self.xxx->forEach(s:string)
print(s+",")
--------------------------------
Thanks
Ye
|
|
|
|
|
|
|
Re: [MOFScript]couldn't print list element [message #620059 is a reply to message #385187] |
Tue, 26 August 2008 04:32  |
Eclipse User |
|
|
|
Hello,
Well, I am not sure what your (s:string) is. Is "s" a reference to some meta
thing in your metamodel? In that case you have forgotten the
inModel.string.. Like if you e.g. want to filter a collection to only return
a uml class you would have to write self.ownedElement->forEach(c: uml.Class)
where uml is the name of your input model parameter.
/G
|
|
|
Re: [MOFScript]couldn't print list element [message #620060 is a reply to message #385188] |
Tue, 26 August 2008 08:05  |
Eclipse User |
|
|
|
Hello,
Well, the problem is still not solved.As I described in my first post,s
means a variable of type String.I think this iteration for string is
right,what do you think?
-------------------------------
I have a class Sca,with one attribute List<String> xxx,I want print all
the elements in this list,I write the following statment in MOFScript:
In the context of Sca,
self.xxx->forEach(s:string)
print(s+",")
--------------------------------
Thanks
Ye
|
|
|
Re: [MOFScript]couldn't print list element [message #620061 is a reply to message #385189] |
Tue, 26 August 2008 09:12  |
Eclipse User |
|
|
|
Hello,
Running:
myMdl.Test::main(){
self.stringList->forEach(s){
stdout.println("A " + s)
}
}
on a model A (test- stringList[eeeeeeee, ttttttttttt]) conforming to
metamodel X containing 1 EClass that has 1 EAttribute of type EString upper
bound -1.
Gives the following result:
## Loading source model - My.test...(Loading time 16 - Msec)
## Executing MOFScript Specification
## Starting transformation: "ExampleTransformation"
A eeeee
A tttttttttttt
I can still not understand what this (s:string) of yours is...
Cheers,
G
|
|
|
|
Powered by
FUDForum. Page generated in 0.10488 seconds