Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 34b6eef8aa26a0f0b7bb5c8a219e77a1f40870bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- @atlcompiler emftvm
-- @nsURI ECORE=http://www.eclipse.org/emf/2002/Ecore
module PrimitiveTypeLazyRuleTest;

create OUT : ECORE from IN : ECORE;

uses "lib::Assert";

rule EPackage {
	from s : ECORE!EPackage
	to t : ECORE!EPackage (
		name <- s.name,
		eClassifiers <- s.eClassifiers
			->select(c | c.oclIsKindOf(ECORE!EClass))
			->collect(c | c.eStructuralFeatures
				->collect(f | thisModule.CartesianEClassifier(c, f.name)))
			->flatten())
	do {
		s.eClassifiers
			->select(c | c.oclIsKindOf(ECORE!EClass))
			->collect(c | 
				c.eStructuralFeatures->collect(f |
					thisModule.assertNotOclUndefined(
						thisModule.resolveTemp(Sequence{c, f.name}, 'CartesianEClassifier', 't')
					)
				)
			);
	}
}

unique lazy abstract rule CartesianEClassifier {
	from s : ECORE!EClassifier,
		 name : String
	to t : ECORE!EClassifier (
		name <- s.name + '_' + name)
}

unique lazy rule CartesianEClass extends CartesianEClassifier {
	from s : ECORE!EClass,
		 name : String
	to t : ECORE!EClass
}

Back to the top