Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Creating new class instance in OCL setting delegate
Creating new class instance in OCL setting delegate [message #668187] Wed, 04 May 2011 11:45 Go to next message
Nikolay Kasyanov is currently offline Nikolay KasyanovFriend
Messages: 30
Registered: September 2010
Location: Russia
Member
Hi!

Trying to use OCL setting delegate for generating attribute value.
I'm implementing some sort of instancing in my metamodel.
So, to fill in SystemInstance's parameters, I'm using setting delegate.
I need to generate new ParameterInstances from corresponding System's parameters attribute (collection of Parameter instances).
So, I need something like this:

if (system.oclIsUndefined()) then
	OrderedSet{}
else
	system.parameters->collect(p | here we create new ParameterInstance with parameter = p)
endif

but I can't figure out how to create ecore class instances in OCL
Here is the related part of ecore metamodel:
http://dl.dropbox.com/u/28481/metamodel.png

[Updated on: Wed, 04 May 2011 11:46]

Report message to a moderator

Re: Creating new class instance in OCL setting delegate [message #668262 is a reply to message #668187] Wed, 04 May 2011 17:46 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Nicholas

[Please use the OCL newsgroup for OCL queries.]

OCL is a side-effect free language so it has no construction of objects.
Except that you can construct collections and tuples.

Construction of new objects is in fact side-effect free so adding an
object construction syntax is under consideration.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=293622

I doubt that helps.

Regards

Ed Willink

On 04/05/2011 12:45, Nicholas Kasyanov wrote:
> Hi!
>
> Trying to use OCL setting delegate for generating attribute value.
> I'm implementing some sort of instancing in my metamodel.
> So, to fill in SystemInstance's parameters, I'm using setting delegate.
> I need to generate new ParameterInstances from corresponding System's
> parameters attribute (collection of Parameter instances).
> So, I need something like this:
>
>
> if (system.oclIsUndefined()) then
> OrderedSet{}
> else
> system.parameters->collect(p | here we create new
> ParameterInstance with parameter = p)
> endif
>
> but I can't figure out how to create ecore class instances in OCL
> Here is the related part of ecore metamodel:
>
Re: Creating new class instance in OCL setting delegate [message #668407 is a reply to message #668262] Thu, 05 May 2011 15:08 Go to previous message
Nikolay Kasyanov is currently offline Nikolay KasyanovFriend
Messages: 30
Registered: September 2010
Location: Russia
Member
Thx for answer and sorry for posting in wrong forum Smile
Previous Topic:How to use generated EMF model code for building a model instance?
Next Topic:Constraints on a dynamic model?
Goto Forum:
  


Current Time: Thu Apr 25 10:03:37 GMT 2024

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

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

Back to the top