[MOFScript]print two list at the same time [message #385194] |
Wed, 27 August 2008 03:41  |
Eclipse User |
|
|
|
Hello,
Now I have two list <String>,I want to show them at the same time,E.g
list1[1]->List2[1]
List1[2]->List2[2]
Since in MOFScript,only one list could be printed once by using
List->forEach()
How should I write this code in MOFScript?
Many thanks!
Ye
|
|
|
|
|
|
|
|
|
Re: [MOFScript]print two list at the same time [message #620439 is a reply to message #385194] |
Wed, 27 August 2008 07:14  |
Eclipse User |
|
|
|
Hello Ye,
The example bellow should give you a hint.
var l1:List
var l2:List
var counter:Integer = 5
counter->forEach(n){
l1.add(n+" : l1")
l2.add(n+" : l2")
}
var counter2:Integer = 0
while(counter2 < l1.size() || counter2 < l1.size()){
if ( l1.get(counter2)!=null ){
stdout.print("List 1: "+l1.get(counter2))
}
if ( l2.get(counter2)!=null ){
stdout.print(" - List 2: "+l2.get(counter2))
}
stdout.println("")
counter2 +=1
}
}
}
Cheers,
G
|
|
|
|
|
Re: [MOFScript]print two list at the same time [message #620455 is a reply to message #385203] |
Thu, 28 August 2008 02:32  |
Eclipse User |
|
|
|
Hi,
Besides those functions listed in the MOFScript developer guide,there
are two more functions:contains(obj) and select() listed in the content
assistant of List.But the get() are highlightend in my editor.It's just
when I execute the code,it says'#Runtime Error in FunctionCallEvaluator
318# Unknown function get for type java.util.ArrayList(line: 53)'
If this is a bug,how should I do to avoid it or is there another way to
get the elements in the list excepte using get()?
In addition,there is such commects in the console view 'name: list1.get,
isSuperCall: false'.Does it means this is a superCall which shouldn't be
applied to subClass? How should I do to prevent it?
Thank you very much!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04313 seconds