Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4184e9df08d07d34c974f68980aaee26f9167a1a (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[comment encoding = UTF-8 /]

[comment]
A representation of the model object 'Attribute Change'. Superclass of elements describing difference between the values of a given attribute. 
[/comment]

[module attributeChange('http://www.eclipse.org/emf/compare/diff/1.1')/]

[import tableUtils/]
[import modelUtils/]
[import common/]

[template public genAttributeChanges(el : DiffElement, leftRoot: String, rightRoot: String) {attributeChanges: Sequence(AttributeChange) = attributeChanges(el); }]
[if not attributeChanges->isEmpty()]
[openTable()/]
[addHeader('Changed Attributes', leftRoot, rightRoot)/]
[for (attributeChanges)]
[genAttributeChange()/]
[/for]
[closeTable()/]
[/if]
[/template]

[template public genAttributeChange(el : AttributeChange)]
[if not el.attribute.oclIsInvalid() and not el.attribute.oclIsUndefined()]
[addRow(el.attribute.name, el.leftElement.eGet(el.attribute).attributeToString(), el.rightElement.eGet(el.attribute).attributeToString())/]
[/if]
[/template]

[comment]
A representation of the model object 'Attribute Change Left Target'. 
A "LeftTarget" element change describes a difference involving the left element/resource. 
In the case of AttributeChanges, these describe differences within multi-valued attributes. 
Specifically, the addition of a value or the remote removal of a value (for three way comparisons). 
[/comment]
[template public genAttributeChange(el : AttributeChangeLeftTarget)]
[addRow(el.attribute.name.concat(' value removed'), noElement().attributeToString(), el.leftTarget.attributeToString())/]
[/template]

[comment]
A representation of the model object 'Attribute Change Right Target'.   
A "RightTarget" element change describes a difference involving the right element/resource. 
In the case of AttributeChanges, these describe differences within multi-valued attributes.
Specifically, the removal of a value or the remote addition of a value (for three way comparisons). 
[/comment]
[template public genAttributeChange(el : AttributeChangeRightTarget)]
[addRow(el.attribute.name.concat(' value added'), noElement(), el.rightTarget.attributeToString())/]
[/template]

[comment]
A representation of the model object 'Update Attribute'.   
Differences of this kind represent modifications of the value of single-valued attributes.
[/comment]
[template public genAttributeChange(el :UpdateAttribute)]
[addRow(el.attribute.name, el.leftElement.eGet(el.attribute).attributeToString(), el.rightElement.eGet(el.attribute).attributeToString())/]
[/template]

[query private attributeChanges(element : DiffElement) : Sequence(AttributeChange) = element.subDiffElements->select(attr: DiffElement| attr.oclIsKindOf(AttributeChange))/]

[query private attributeToString(element : OclAny) : String = element.toString()/]

Back to the top