-
Notifications
You must be signed in to change notification settings - Fork 2
/
generateSubTemplates.mtl
48 lines (42 loc) · 1.89 KB
/
generateSubTemplates.mtl
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
43
44
45
46
47
48
[comment encoding = UTF-8 /]
[module generateSubTemplates('http://rules/core/1.0', 'http://rules/evol/1.0')]
[comment MDE_BOOK_START /]
[template public generateRule(aRule : Rule)]
if([aRule.filter.generateFilter()/]){
tut.grid.field['['/]x[']['/]y[']'/] = [aRule.evaluatedVal.generateExpression()/];
}
[/template]
[comment MDE_BOOK_END /]
[template public generateFilter(aFilter : Filter)]
[/template]
[comment MDE_BOOK_START /]
[template public generateFilter(aFilter : PopulationRange)]
[aFilter.lowerRange/] <= currentVal && currentVal <= [aFilter.upperRange/]
[/template]
[comment MDE_BOOK_END /]
[template public generateExpression(anExpression : IntegerExpression)]
/* TODO Implement template generateExpression for type [eClass().name/] */
[/template]
[comment MDE_BOOK_START /]
[template public generateExpression(aLiteral : IntegerLiteral)]
[aLiteral.val/]
[/template]
[template public generateExpression(aCurrentCellPopulation : CurrentCellPopulation)]
currentVal
[/template]
[template public generateExpression(aGreater : Greater)]
([aGreater.left.generateExpression()/] > [aGreater.right.generateExpression()/] ? 1 : 0)
[/template]
[comment MDE_BOOK_END /]
[template public generateExpression(aConditional : Conditional)]
[aConditional.condition.generateExpression()/]== 1 ? [aConditional.ifTrueExpression.generateExpression()/] : [aConditional.ifFalseExpression.generateExpression()/]
[/template]
[template public generateExpression(anAdd : Add)]
([anAdd.left.generateExpression()/] + [anAdd.right.generateExpression()/])
[/template]
[template public generateExpression(anEqual : Equal)]
([anEqual.left.generateExpression()/] == [anEqual.right.generateExpression()/] ? 1 : 0)
[/template]
[template public generateExpression(anAnd : And)]
((([anAnd.left.generateExpression()/] != 0) && ([anAnd.right.generateExpression()/] != 0)) ? 1 : 0)
[/template]