Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » allInstances OrderedSet
allInstances OrderedSet [message #1072734] Tue, 23 July 2013 11:55 Go to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

is there a way to get an OrderedSet out of allInstances()? I get a new order each time I call it.

Ralph
Re: allInstances OrderedSet [message #1072740 is a reply to message #1072734] Tue, 23 July 2013 12:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4151
Registered: July 2009
Senior Member
Hi

allInstances()->asOrderedSet() gives you an OrderedSet, but you probably
want a sensible ordering too, so something more like

NamedElement.allInstances()->sortedBy(name)

may be better.

Regards

Ed Willink

On 23/07/2013 12:55, Ralph Gerbig wrote:
> Hi,
>
> is there a way to get an OrderedSet out of allInstances()? I get a new
> order each time I call it.
>
> Ralph
Re: allInstances OrderedSet [message #1072796 is a reply to message #1072740] Tue, 23 July 2013 14:08 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

my problem is that allInstances is already a set and has a different order each time it is called. Putting it into an ordered set could help while the program is running as I would get a temporary order. The problem is that I need to have the same order even if I restart the program in between. Ordering by something like a name could help. I think I will walk the model manually and collect the instances.

Thanks!!

Ralph
Previous Topic:OCL closure operation: org.eclipse.ocl.SemanticException: Usage of non-standard "closure"
Next Topic:Pb with closure operation
Goto Forum:
  


Current Time: Mon Nov 24 07:17:42 GMT 2014

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

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