Skip to main content


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 21:43 Go to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012
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 22:10 Go to previous messageGo to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012
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 10:34 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
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, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: Problem with getValue [message #1095220 is a reply to message #1094882] Mon, 26 August 2013 19:58 Go to previous messageGo to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012
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 10:49 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
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, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Previous Topic:Not a valid classifier
Next Topic:loop
Goto Forum:
  


Current Time: Tue Apr 23 12:59:44 GMT 2024

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

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

Back to the top