Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » return arraylist in operation
icon4.gif  return arraylist in operation [message #1578632] Thu, 22 January 2015 14:16 Go to next message
maoyi huang is currently offline maoyi huangFriend
Messages: 4
Registered: January 2015
Junior Member
Hi,

I am new to papyrus and the EMF. I am trying to return an arraylist in the operation but all I can find is a thing called Elist. I have no idea how to work on that nor translate it into the Arraylist. I hope there are some solutions to that? Thanks in advance!
Re: return arraylist in operation [message #1578745 is a reply to message #1578632] Thu, 22 January 2015 15:40 Go to previous messageGo to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

Hi,

welcome to papyrus and EMF!
I'm not sure, what's exactly context of your problem, but the UML in general (and papyrus diagrams) handle return values as a parameter which is specified as return type. The multiplicity of such parameter can be configured by the upperBound property.
Re: return arraylist in operation [message #1578912 is a reply to message #1578632] Thu, 22 January 2015 17:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I presume you mean ArrayList.

Normally you only care about ArrayList when you construct it. Thereafter
you should use List or Collection or Iterable.

The particular List derivative favoured in EMF is EList that has an
extra move() operation avoiding double chnages for simple manipulations.

Use EList just as you use List.

If you need to construct one have a look at BasicEList and ECollections.

Regards

Ed Willink

On 22/01/2015 15:35, maoyi huang wrote:
> Hi,
>
> I am new to papyrus and the EMF. I am trying to return an arraylist in
> the operation but all I can find is a thing called Elist. I have no idea
> how to work on that nor translate it into the Arraylist. I hope there
> are some solutions to that? Thanks in advance!
Re: return arraylist in operation [message #1579037 is a reply to message #1578745] Thu, 22 January 2015 19:22 Go to previous messageGo to next message
maoyi huang is currently offline maoyi huangFriend
Messages: 4
Registered: January 2015
Junior Member
Hi!

Thanks for the welcome! Smile
I am trying to build a hotel system (simple version) by using Papyrus model. So at first I am trying to draw some class diagrams to represent the system. And there is one interface class that I want to use it to make reservations for the room. So ultimately in that operation I want to return a list-like stuff to contain the room's information with the customer's profile. So for example I figure it might be an arraylist. But when I was building the operation in makeReservation interface, I couldn't find a proper type in the <ModelLibrary> and <Epackage ModelLlibrary> . The only thing is the Elist which looks close to the one I want. But the problem is I have no idea how to operate this Elist (initiate, declare, does it need to import extra library to run it?), so I am quite frustrated on that one. I hope this makes sense and possibly there is a solution to it. Thanks!
Re: return arraylist in operation [message #1579056 is a reply to message #1579037] Thu, 22 January 2015 19:37 Go to previous messageGo to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

As already mentioned, you have to set the values for the return parameter. So you can add an Owned Parameter with Direction=return and Multiplicity=0..*. As Type you can select any Type in your model, e.g. a class containing your data.
It is also possible to apply the UML standard profile to UML models, which provides you some standard data types like Integer, String and Boolean.
Does this address your question?
Re: return arraylist in operation [message #1585774 is a reply to message #1579056] Mon, 26 January 2015 13:26 Go to previous messageGo to next message
maoyi huang is currently offline maoyi huangFriend
Messages: 4
Registered: January 2015
Junior Member
Yeah I already did that. I know how to select Type in my model but I was just having no idea how to use one of those types there. I know how to declare a standard data types like integer or String, but I wanted to declare a list (something like arraylist which is not a primitive type there unfortunately) so that's why I ask. But now I think I have found some guidance! Still thanks for the help!

Joachim Engelhardt wrote on Thu, 22 January 2015 19:37
As already mentioned, you have to set the values for the return parameter. So you can add an Owned Parameter with Direction=return and Multiplicity=0..*. As Type you can select any Type in your model, e.g. a class containing your data.
It is also possible to apply the UML standard profile to UML models, which provides you some standard data types like Integer, String and Boolean.
Does this address your question?

Re: return arraylist in operation [message #1585781 is a reply to message #1578912] Mon, 26 January 2015 13:31 Go to previous message
maoyi huang is currently offline maoyi huangFriend
Messages: 4
Registered: January 2015
Junior Member
Thanks for the heads-up! So I can just declare EList as I use List in Java right?
I also looked up the BasicElist and ECollections and figure those are just the ones I need!

Also some extra operations like move() as you said really confused me from the start. I mean that's why I felt it looks like Java code but there are actually some difference!

Thanks very much for the suggestion again! Smile

Ed Willink wrote on Thu, 22 January 2015 17:39
Hi

I presume you mean ArrayList.

Normally you only care about ArrayList when you construct it. Thereafter
you should use List or Collection or Iterable.

The particular List derivative favoured in EMF is EList that has an
extra move() operation avoiding double chnages for simple manipulations.

Use EList just as you use List.

If you need to construct one have a look at BasicEList and ECollections.

Regards

Ed Willink

On 22/01/2015 15:35, maoyi huang wrote:
> Hi,
>
> I am new to papyrus and the EMF. I am trying to return an arraylist in
> the operation but all I can find is a thing called Elist. I have no idea
> how to work on that nor translate it into the Arraylist. I hope there
> are some solutions to that? Thanks in advance!

Previous Topic:Re: Rich Text Editor for SysML Comments
Next Topic:SysML Version?
Goto Forum:
  


Current Time: Thu Mar 28 14:55:12 GMT 2024

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

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

Back to the top