Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Problem with getValue
Problem with getValue [message #1093281] Fri, 23 August 2013 17:43 Go to next message
Jeni Martin is currently offline Jeni Martin
Messages: 28
Registered: November 2012
Junior Member
Hi,

I have defined a helper that a class uses and I want to count the number of elements that have a specific value. So I used getValue but I receive error. Can any one help?

helper context MM! Class
def: MappedSize (): Integer=
MM!Association.allInstancesFrom('IN')->select (e|e.hasStereotype('Pro::Mapps')
and e.endType->first()=self) ->
select (e|e.endType->last().getValue(e.endType->last().getAppliedStereotypes()-> at(1), 'source')='IN')->size()
;


here is the error that I receive in console:
org.eclipse.m2m.atl.engine.emfvm.VMException: Exception during invocation of operation getValue on org.eclipse.uml2.uml.internal.impl.ClassImpl@2fd9cee8


Thanks a lot.
Re: Problem with getValue [message #1093292 is a reply to message #1093281] Fri, 23 August 2013 18:10 Go to previous messageGo to next message
Jeni Martin is currently offline Jeni Martin
Messages: 28
Registered: November 2012
Junior Member
Is the problem can be that I defined the Value of Souce as Enum?

Re: Problem with getValue [message #1094882 is a reply to message #1093292] Mon, 26 August 2013 06:34 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Hello,

What is the actual type of the element returned by the expression e.endType->last()?
I'm not sure you have to call getValue() on it.

Best regards,


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: Problem with getValue [message #1095220 is a reply to message #1094882] Mon, 26 August 2013 15:58 Go to previous messageGo to next message
Jeni Martin is currently offline Jeni Martin
Messages: 28
Registered: November 2012
Junior Member
Hi,

Thank you very much for your reply. The end type is a class which has an attribute of source. this attribute is from the type of a previously defined Enumeration.

Thanks a lot.
Re: Problem with getValue [message #1095654 is a reply to message #1095220] Tue, 27 August 2013 06:49 Go to previous message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Hello,

Have you tried something like e.endType->last().source to access to the expected value?
Related to enumerations, the way to refer to an enumeration literal is the following one: e.myAttributeOfTypeEnum = #myEnumLiteral (cf. also the ATL user guide).

Best regards,


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Previous Topic:Not a valid classifier
Next Topic:loop
Goto Forum:
  


Current Time: Tue Jul 29 07:03:05 EDT 2014

Powered by FUDForum. Page generated in 0.02770 seconds