@@ -63,96 +63,96 @@ public class NormalAspectGraph extends AspectGraph {
63
63
/**
64
64
* Creates the normalised version of a given aspect graph.
65
65
* Normalisation occurs upon the call if {@link #setFixed()}.
66
- * @param source the (non-normalised) source of this normalised aspect graph
66
+ * @param origin the (non-normalised) source of this normalised aspect graph
67
67
*/
68
- public NormalAspectGraph (AspectGraph source ) {
69
- super (source .getName (), source .getRole (), source .isSimple ());
70
- var toNormalMap = this .sourceToNormalMap = new AspectGraphMorphism (this );
71
- source .cloneTo (toNormalMap );
72
- this .source = source ;
73
- this .normalToSourceMap = initNormalToSourceMap ();
68
+ public NormalAspectGraph (AspectGraph origin ) {
69
+ super (origin .getName (), origin .getRole (), origin .isSimple ());
70
+ var toNormalMap = this .originToNormalMap = new AspectGraphMorphism (this );
71
+ origin .cloneTo (toNormalMap );
72
+ this .origin = origin ;
73
+ this .normalToOriginMap = initNormalToOriginalMap ();
74
74
}
75
75
76
76
@ Override
77
77
public boolean isNormal () {
78
78
return true ;
79
79
}
80
80
81
- /** Returns the (non-normalised) source of this normalised aspect graph. */
82
- public AspectGraph getOriginal () {
83
- return this .source ;
81
+ /** Returns the (non-normalised) origin of this normalised aspect graph. */
82
+ public AspectGraph getOrigin () {
83
+ return this .origin ;
84
84
}
85
85
86
- /** Returns the (non-normalised) source of this normalised aspect graph. */
87
- public FormatErrorSet getOriginalErrors () {
88
- return getErrors ().apply (this .normalToSourceMap );
86
+ /** Returns the errors in this normal graph, transferred to the context of the origin . */
87
+ public FormatErrorSet getOriginErrors () {
88
+ return getErrors ().apply (this .normalToOriginMap );
89
89
}
90
90
91
91
/** The (non-normalised) source of this normalised aspect graph. */
92
- private final AspectGraph source ;
92
+ private final AspectGraph origin ;
93
93
94
94
/** Returns the morphism from the source {@link AspectGraph} to this normalised {@link AspectGraph}.
95
95
* Should only be called after the normalised graph has been fixed.
96
96
*/
97
- public AspectGraphMorphism sourceToNormalMap () {
97
+ public AspectGraphMorphism originToNormalMap () {
98
98
assert isFixed ();
99
- return this .sourceToNormalMap ;
99
+ return this .originToNormalMap ;
100
100
}
101
101
102
102
/** Morphism from the source {@link AspectGraph} to the normalised {@link AspectGraph}. */
103
- private final AspectGraphMorphism sourceToNormalMap ;
103
+ private final AspectGraphMorphism originToNormalMap ;
104
104
105
- /** Computes the inverse of {@link #sourceToNormalMap }. */
106
- private final Map <AspectElement ,AspectElement > initNormalToSourceMap () {
105
+ /** Computes the inverse of {@link #originToNormalMap }. */
106
+ private final Map <AspectElement ,AspectElement > initNormalToOriginalMap () {
107
107
Map <AspectElement ,AspectElement > result = new HashMap <>();
108
- var toNormalMap = this .sourceToNormalMap ;
108
+ var toNormalMap = this .originToNormalMap ;
109
109
toNormalMap .nodeMap ().entrySet ().forEach (e -> result .put (e .getValue (), e .getKey ()));
110
110
toNormalMap .edgeMap ().entrySet ().forEach (e -> result .put (e .getValue (), e .getKey ()));
111
111
return result ;
112
112
}
113
113
114
- /** Adds an entry to the {@link #normalToSourceMap } for a new element in the
114
+ /** Adds an entry to the {@link #normalToOriginMap } for a new element in the
115
115
* normalised graph, based on an original element (also of this graph).
116
116
*/
117
117
private void addNormalToSource (AspectElement orig , AspectElement added ) {
118
- var normalToSourceMap = this .normalToSourceMap ;
118
+ var normalToSourceMap = this .normalToOriginMap ;
119
119
normalToSourceMap .put (added , normalToSourceMap .get (orig ));
120
120
}
121
121
122
122
/** Replaces a given aspect edge in this normalised graph by another, in the
123
- * {@link #sourceToNormalMap } and {@link #normalToSourceMap }.
123
+ * {@link #originToNormalMap } and {@link #normalToOriginMap }.
124
124
* Does not remove or add either of the edges from or to the graph
125
125
* @param orig the original edge
126
126
* @param replacement the new edge
127
127
*/
128
128
private void replaceNormalisedEdge (AspectEdge orig , AspectEdge replacement ) {
129
- var source = this .normalToSourceMap .remove (orig );
129
+ var source = this .normalToOriginMap .remove (orig );
130
130
if (source instanceof AspectEdge edge ) {
131
- this .sourceToNormalMap .putEdge (edge , replacement );
131
+ this .originToNormalMap .putEdge (edge , replacement );
132
132
}
133
133
}
134
134
135
135
/** Replaces a given aspect node in this normalised graph by another, in the
136
- * {@link #sourceToNormalMap } and {@link #normalToSourceMap }.
136
+ * {@link #originToNormalMap } and {@link #normalToOriginMap }.
137
137
* Does not remove or add either of the nodes from or to the graph
138
138
* @param orig the original node
139
139
* @param replacement the new node
140
140
*/
141
141
private void replaceNormalisedNode (AspectNode orig , AspectNode replacement ) {
142
- var source = (AspectNode ) this .normalToSourceMap .remove (orig );
143
- this .sourceToNormalMap .putNode (source , replacement );
142
+ var source = (AspectNode ) this .normalToOriginMap .remove (orig );
143
+ this .originToNormalMap .putNode (source , replacement );
144
144
}
145
145
146
146
/** Returns the morphism from this normalised graph to the source {@link AspectGraph}.
147
147
* Should only be called after the normalised graph has been fixed.
148
148
*/
149
- public Map <AspectElement ,AspectElement > normalToSourceMap () {
149
+ public Map <AspectElement ,AspectElement > normalToOriginalMap () {
150
150
assert isFixed ();
151
- return this .normalToSourceMap ;
151
+ return this .normalToOriginMap ;
152
152
}
153
153
154
- /** Inverse of the {@link #sourceToNormalMap } before actual normalisation. */
155
- private final Map <AspectElement ,AspectElement > normalToSourceMap ;
154
+ /** Inverse of the {@link #originToNormalMap } before actual normalisation. */
155
+ private final Map <AspectElement ,AspectElement > normalToOriginMap ;
156
156
157
157
private AspectNode addNormalisedNode (AspectElement orig ) {
158
158
AspectNode result = addNode ();
@@ -331,7 +331,7 @@ private void doNormalise() {
331
331
removeNode (node );
332
332
}
333
333
addErrors (errors );
334
- getErrors ().apply (this .normalToSourceMap );
334
+ getErrors ().apply (this .normalToOriginMap );
335
335
}
336
336
337
337
/**
0 commit comments