Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MOFScript » Re: list.remove(object) remove all the rest elements:
Re: list.remove(object) remove all the rest elements: [message #469045] Thu, 11 September 2008 15:09
Gøran K. Olsen is currently offline Gøran K. OlsenFriend
Messages: 184
Registered: July 2009
Senior Member
Hello Ye,


Again I can not recreate your problem.

The following code:

uml.Model::main () {
var l:List
var s1:String = "fffff"
var s2:String = "11fffff"
var s3:String = "22fffff"
var s4:String = "33fffff"
var s5:String = "44fffff"
var s6:String = "55fffff"
l.add(s1)
l.add(s2)
l.add(s3)
l.add(s4)
l.add(s5)
l.add(s6)
var i: Integer = 0
while(i < l.size()){
stdout.println("MMM "+l.get(i))
i+= 1
}
l.remove(s4)
var j: Integer = 0
while(j < l.size()){
stdout.println("MMM "+l.get(j))
j+= 1
}
}
Gives the output:

## Executing MOFScript Specification
## Starting transformation: "ExampleTransformation"
MMM fffff
MMM 11fffff
MMM 22fffff
MMM 33fffff
MMM 44fffff
MMM 55fffff
Size before: 6
Size after: 5
MMM fffff
MMM 11fffff
MMM 22fffff
MMM 44fffff
MMM 55fffff
## Finished transformation: "ExampleTransformation"


/G
Previous Topic:Welcome to eclipse.mofscript
Next Topic:Re: list.remove(object) remove all the rest elements:
Goto Forum:
  


Current Time: Sun Mar 29 20:51:47 GMT 2015

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

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