Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to model an array of element ?
How to model an array of element ? [message #630478] Sun, 03 October 2010 07:04 Go to next message
Tianfu Ma is currently offline Tianfu MaFriend
Messages: 6
Registered: October 2010
Junior Member
I'am a newbie to ecore model and EMF tools. Now I am trying to build a model for my project and here is my problem:

We have three basic concepts: component, port, and port connections. All of them are typed but it's not difficult to model them. My question is how to model an array of port?

A component may have a port array which consists of several ports with same type and are sequentially indexed. In model, the size of array is not provided but is left to user for definition.

Once user provide the exact array size, the array then have the given number of ports and user can use them as the port connection's source or destination.

Is it possible to implement the concept (user-defined port array size will generate ports) in development time model? or should I manipulate the code to implement it in runtime?

Re: How to model an array of element ? [message #630481 is a reply to message #630478] Sun, 03 October 2010 07:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Tianfu,
one possibility is to model the array relation with a multiplicity of *.
That means that the elements can be more than 1. Then you can add an
attribute "count" to your metaclass which the user will be set at
runtime. But how to restrict the *-relation to only have "count"
elements? This could be realised with an OCL constraint for example. But
I'm sure that Ed Merks will come up with another idea :)

best regards,
Gilbert


Tianfu Ma wrote:
> I'am a newbie to ecore model and EMF tools. Now I am trying to build a
> model for my project and here is my problem:
>
> We have three basic concepts: component, port, and port connections. All
> of them are typed but it's not difficult to model them. My question is
> how to model an array of port?
>
> A component may have a port array which consists of several ports with
> same type and are sequentially indexed. In model, the size of array is
> not provided but is left to user for definition.
>
> Once user provide the exact array size, the array then have the given
> number of ports and user can use them as the port connection's source or
> destination.
>
> Is it possible to implement the concept (user-defined port array size
> will generate ports) in development time model? or should I manipulate
> the code to implement it in runtime?
>
>
Re: How to model an array of element ? [message #630510 is a reply to message #630481] Sun, 03 October 2010 15:52 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020205070408060808030605
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Gilbert,

Yes, I'd model it as a multi-valued feature. I'm not sure I totally
follow it issue with the "array size" but certainly it can be mapped to
an issue of list size instead. Probably there's some constraint about
the source and target port numbers matching; that could be modeled as a
named constraints on the appropriate EClass and then implemented in the
generated validator.

The EMF Validation Framework Overview
< http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.Validation.html>


Gilbert Mirenque wrote:
> Tianfu,
> one possibility is to model the array relation with a multiplicity of *.
> That means that the elements can be more than 1. Then you can add an
> attribute "count" to your metaclass which the user will be set at
> runtime. But how to restrict the *-relation to only have "count"
> elements? This could be realised with an OCL constraint for example. But
> I'm sure that Ed Merks will come up with another idea :)
>
> best regards,
> Gilbert
>
>
> Tianfu Ma wrote:
>
>> I'am a newbie to ecore model and EMF tools. Now I am trying to build a
>> model for my project and here is my problem:
>>
>> We have three basic concepts: component, port, and port connections. All
>> of them are typed but it's not difficult to model them. My question is
>> how to model an array of port?
>>
>> A component may have a port array which consists of several ports with
>> same type and are sequentially indexed. In model, the size of array is
>> not provided but is left to user for definition.
>>
>> Once user provide the exact array size, the array then have the given
>> number of ports and user can use them as the port connection's source or
>> destination.
>>
>> Is it possible to implement the concept (user-defined port array size
>> will generate ports) in development time model? or should I manipulate
>> the code to implement it in runtime?
>>
>>
>>

--------------020205070408060808030605
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gilbert,<br>
<br>
Yes, I'd model it as a multi-valued feature.   I'm not sure I totally
follow it issue with the "array size" but certainly it can be mapped to
an issue of list size instead.  Probably there's some constraint about
the source and target port numbers matching; that could be modeled as a
named constraints on the appropriate EClass and then implemented in the
generated validator.<br>
<blockquote><a
href=" http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.Validation.html">The
EMF Validation Framework Overview</a><br>
</blockquote>
<br>
Gilbert Mirenque wrote:
<blockquote cite="mid:i89abv$qbn$1@news.eclipse.org" type="cite">
<pre wrap="">Tianfu,
one possibility is to model the array relation with a multiplicity of *.
That means that the elements can be more than 1. Then you can add an
attribute "count" to your metaclass which the user will be set at
runtime. But how to restrict the *-relation to only have "count"
elements? This could be realised with an OCL constraint for example. But
I'm sure that Ed Merks will come up with another idea :)

best regards,
Gilbert


Tianfu Ma wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I'am a newbie to ecore model and EMF tools. Now I am trying to build a
model for my project and here is my problem:

We have three basic concepts: component, port, and port connections. All
of them are typed but it's not difficult to model them. My question is
how to model an array of port?

A component may have a port array which consists of several ports with
same type and are sequentially indexed. In model, the size of array is
not provided but is left to user for definition.

Once user provide the exact array size, the array then have the given
number of ports and user can use them as the port connection's source or
destination.

Is it possible to implement the concept (user-defined port array size
will generate ports) in development time model? or should I manipulate
the code to implement it in runtime?


</pre>
</blockquote>
</blockquote>
</body>
</html>

--------------020205070408060808030605--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:What is the best practice to keep the generated and handmade code in separate files ?
Next Topic:Getting the File name and Path From EMF URI
Goto Forum:
  


Current Time: Fri Mar 29 02:18:56 GMT 2024

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

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

Back to the top