Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCORE] how to create an EList in an operation
[XCORE] how to create an EList in an operation [message #1265913] Thu, 06 March 2014 18:39 Go to next message
Roger Gilliar is currently offline Roger GilliarFriend
Messages: 40
Registered: March 2010
Member
Hi,

I trying to write the following operation:

op ChannelDescription[] channels() {
	var ChannelDescription[]  channels
	for (Module module : modules) {
		channels.addAll(module.channelDescription)
	}
	return channels
}


This gives me a type mismatch error. And how do I create a List of ChannelDescriptions ? The purpose of this op is to flatten the module list and to return a list of all ChannelDescriptions from all modules.

Regards
Rpger
Re: [XCORE] how to create an EList in an operation [message #1265929 is a reply to message #1265913] Thu, 06 March 2014 19:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Roger,

You can define a data type that wraps any existing Java type, e.g., type
List<E> wraps java.util.List. Xbase provides more elegant ways to
express this type of thing. Look at some of the nice Xtend examples
(becaue Xtend also uses Xbase)...


On 06/03/2014 7:39 PM, Roger Gilliar wrote:
> Hi,
>
> I trying to write the following operation:
>
> op ChannelDescription[] channels() {
> var ChannelDescription[] channels
> for (Module module : modules) {
> channels.addAll(module.channelDescription)
> }
> return channels
> }
>
> This gives me a type mismatch error. And how do I create a List of
> ChannelDescriptions ? The purpose of this op is to flatten the module
> list and to return a list of all ChannelDescriptions from all modules.
>
> Regards
> Rpger


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:CDO Revisions not Persisting in HSQLDB
Next Topic:how to create a model compliant metamodel. ecore?
Goto Forum:
  


Current Time: Fri Apr 19 12:04:36 GMT 2024

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

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

Back to the top