analysis.atl 909 Bytes
Newer Older
Gerson Sunyé's avatar
Gerson Sunyé committed
1
2
3
-- @nsURI smm=http://www.eclipse.org/MoDisco/SMM/1.0.Beta2/smm
-- @nsURI java=http://www.eclipse.org/MoDisco/Java/0.2.incubation/java

Gerson Sunyé's avatar
Gerson Sunyé committed
4
5

module analysis;
Gerson Sunyé's avatar
Gerson Sunyé committed
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
create OUT: smm from IN: java;

rule Java2SMM {
	from
		project: java!Model
	to
		model: smm!SmmModel (
			name <- project.name,
			librairies <- lib
		),
		lib: smm!MeasureLibrary (
			name <- 'Java metrics',
			measureElements <- thisModule.allMeasures(project)
		)
}

helper def: allMeasures(project : java!Model): Set(smm!Measure) =
	Set{
	thisModule.numberOfClasses()
	--
	-- Placeholder for other Measures
	--
};


rule numberOfClasses() {
	to
		om: smm!ObservedMeasure (
			measure <- noc,
			measurements <- measurement
		),
		noc: smm!DimensionalMeasure (
			name <- 'Number of Classes'
		),
		measurement: smm!DirectMeasurement (
			value <- java!ClassDeclaration.allInstances() -> reject(each | each.isProxy()) -> size()
		)
Gerson Sunyé's avatar
Gerson Sunyé committed
43

Gerson Sunyé's avatar
Gerson Sunyé committed
44
45
46
47
	do {
		noc; 
	}
}