[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.m2m] [ATL] Re: derived classes

Dear Gediminas,

First, can you please stick with this newsgroup rules and prefix all of your messages with [ATL] as their is more than one component in Eclipse Modeling's M2M project.

Concerning your question, you cannot have multiple rules with the same name. I suggest you re-writing (if possible) your rules not to have lazy rules but matched (classical) rules. This way, you will be able to use rule inheritance feature (which is not available for lazy rules, i think):

abstract rule Parent {
	from i: MM!Parent
	..
}

rule A extends Parent {
	from i : MM!derivedA
	..
}

rule B extends Parent {
	from i : MM!derivedB
	..
}

and don't forget to specify on your first this comment:
--@atlcompiler atl2006
and to checkout the atl2006 compiler's plug-in.

Best regards,
Mikael

Gediminas a écrit :
my code:

class Parent {}
class derivedA extends Parent {}
class derivedB extends Parent {
 attribute b : Double;
}

classes[*] container : Parent;

classes->collect( class | thisModule.Do( class ) )

lazy rule Do {
from class : MM!derivedA
..
}

lazy rule Do {
from class : MM!derivedB
..
 class.b fails with message MM!derivedA don't have b feature
}

why class.b fails, event then lazy rule Do is matched for the MM!derivedB?




-- Mikaël Barbero - PhD Candidate ATLAS Group (INRIA & LINA) - University of Nantes 2, rue de la Houssinière 44322 Nantes Cedex 3 - France tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00 email: Mikael.Barbero@{gmail.com, univ-nantes.fr} http://www.sciences.univ-nantes.fr/lina/atl/