Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Help for using properties through collection
Help for using properties through collection [message #1066818] Thu, 04 July 2013 14:04 Go to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hello,

I had class which inherited from another.

I would like to get mother class' qualifiedName if it exists or 'tis.dos.allocated' if not. I retrieve all mother class' nameSpace and store them in a collecdtion. I iterated that collection to get qualiffiedName but the problem is that it is not allow having properties into a collection.

What Can I do?
Thank you in advance for your help.

Note: bellow the source code and the console output.

********* Source code *********
 helper context UML!Class  def : getTarget() : Sequence(UML!NamedElement) =
		self.generalization->collect(t | t.target);
 
 helper context UML!Class  def : getBase() : String =
	if self.generalization.notEmpty() then 
		self.getTarget()->iterate(qualName; n : String = '' |qualName.qualifiedName)
	else 
		'tis.dos.Allocated'
	endif;

rule ClassType {
	from
		c : UML!Class (
			c.package.needToGeneratePackage and not
			(c.isDataType or c.isExclusiState or c.isCombinedState)
		)
	to 
		ct : AllSom!ClassType(
			comment <- c.getComment(),
			base <- c.getBase().debug(), -- traitement à modifier
			name <- c.name			
		)
}


********* Output console *********
org.eclipse.m2m.atl.engine.emfvm.VMException: Collections do not have properties, use ->collect()
	at getBase#13(uml2allsom.atl[122:56-122:78])
		local variables: self=IN!PicNavData, n='', qualName=Sequence {IN!PicData}
...
...
...
...

[Updated on: Thu, 04 July 2013 14:05]

Report message to a moderator

Re: Help for using properties through collection [message #1067410 is a reply to message #1066818] Mon, 08 July 2013 14:33 Go to previous message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
this code is working

 helper context UML!Class  def : getTargetInheritance() : UML!NamedElement =
	self.generalization->select(e | e.target.notEmpty()).first().target.first();	
  
 helper context UML!Class  def : getBase() : String =
	if self.generalization.isEmpty() then 
		'tis.dos.Allocated'
	else 
		self.getTargetInheritance().qualifiedName
	endif;

[Updated on: Mon, 08 July 2013 14:34]

Report message to a moderator

Previous Topic:ifExp in ATL textual syntax.
Next Topic:EMFTVM - Resolving source elements in refining mode
Goto Forum:
  


Current Time: Thu Apr 18 15:59:16 GMT 2024

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

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

Back to the top