Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Adding a new element
[QVTo] Adding a new element [message #653366] Wed, 09 February 2011 14:37 Go to next message
Haffi is currently offline HaffiFriend
Messages: 39
Registered: November 2010
Member
Hi, I'm sorry for asking such a simple question but how do I create a new element in QVTo? I've got this code:

var newActivity : UML::ActivityNode;
newActivity.name := "someName";


But the variable is always null even though I change it's properties. I guess it's something simple I'm missing but I haven't found any examples of how this is done properly.
Re: [QVTo] Adding a new element [message #653375 is a reply to message #653366] Wed, 09 February 2011 15:08 Go to previous messageGo to next message
Dennis Hendriks is currently offline Dennis HendriksFriend
Messages: 66
Registered: January 2010
Location: Eindhoven, The Netherland...
Member
Hi Haffi,

I assume this is some sort of local variable. You have to create a new
object (instance of UML::ActivityNode). Declaring a variable of a certain
type doesn't automatically create a new instance of such a type.

You could change your code to:

var newActivity : UML::ActivityNode;
newActivity := object UML:ActivityNode {
name := "someName";
}

Best regards,
Dennis



Haffi wrote:
> Hi, I'm sorry for asking such a simple question but how do I create a
> new element in QVTo? I've got this code:
>
> var newActivity : UML::ActivityNode;
> newActivity.name := "someName";
>
> But the variable is always null even though I change it's properties. I
> guess it's something simple I'm missing but I haven't found any examples
> of how this is done properly.
Re: [QVTo] Adding a new element [message #653651 is a reply to message #653375] Thu, 10 February 2011 14:36 Go to previous messageGo to next message
Haffi is currently offline HaffiFriend
Messages: 39
Registered: November 2010
Member
Hi, thank you for your detailed answer. I got a new problem though, an error message says: "Can't instantiate abstract type 'uml::ActivityNode'" Do you have any idea what's going on?
Re: [QVTo] Adding a new element [message #653782 is a reply to message #653651] Fri, 11 February 2011 07:10 Go to previous messageGo to next message
Dennis Hendriks is currently offline Dennis HendriksFriend
Messages: 66
Registered: January 2010
Location: Eindhoven, The Netherland...
Member
If a class is abstract, you cannot create an instance of it. That is kind
of the whole point of having an abstract class. You have to create an
instance of one of its derived classes. This is all standard object
oriented programming, and it is exactly the way that any object oriented
programming language works, like Java, C#, etc.

Dennis


Haffi wrote:
> Hi, thank you for your detailed answer. I got a new problem though, an
> error message says: "Can't instantiate abstract type
> 'uml::ActivityNode'" Do you have any idea what's going on?
Re: [QVTo] Adding a new element [message #654358 is a reply to message #653782] Tue, 15 February 2011 11:49 Go to previous message
Haffi is currently offline HaffiFriend
Messages: 39
Registered: November 2010
Member
Hi,

I have no idea why I didn't figure that out myself. Thank you for being patient though Wink
Previous Topic:State Machine Transformation
Next Topic:ATL : One input model, multiple output models, how to
Goto Forum:
  


Current Time: Mon Aug 19 04:15:41 GMT 2019

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

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

Back to the top