@lionweb/class-core 0.7.0-beta.10 → 0.7.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/base-types.d.ts.map +1 -1
- package/dist/base-types.js.map +1 -1
- package/dist/convenience.d.ts.map +1 -1
- package/dist/deltas/appliers.d.ts +3 -2
- package/dist/deltas/appliers.d.ts.map +1 -1
- package/dist/deltas/appliers.js +362 -160
- package/dist/deltas/appliers.js.map +1 -1
- package/dist/deltas/handlers.d.ts.map +1 -1
- package/dist/deltas/inverters.d.ts.map +1 -1
- package/dist/deltas/inverters.js +65 -26
- package/dist/deltas/inverters.js.map +1 -1
- package/dist/deltas/serialization/deserializer.g.d.ts.map +1 -1
- package/dist/deltas/serialization/deserializer.g.js +168 -57
- package/dist/deltas/serialization/deserializer.g.js.map +1 -1
- package/dist/deltas/serialization/serializer-helpers.d.ts.map +1 -1
- package/dist/deltas/serialization/serializer.g.d.ts +2 -2
- package/dist/deltas/serialization/serializer.g.d.ts.map +1 -1
- package/dist/deltas/serialization/serializer.g.js +186 -47
- package/dist/deltas/serialization/serializer.g.js.map +1 -1
- package/dist/deltas/serialization/types.g.d.ts +156 -43
- package/dist/deltas/serialization/types.g.d.ts.map +1 -1
- package/dist/deltas/types.g.d.ts +155 -55
- package/dist/deltas/types.g.d.ts.map +1 -1
- package/dist/deltas/types.g.js +170 -57
- package/dist/deltas/types.g.js.map +1 -1
- package/dist/deserializer.d.ts.map +1 -1
- package/dist/deserializer.js +4 -4
- package/dist/deserializer.js.map +1 -1
- package/dist/duplicator.d.ts.map +1 -1
- package/dist/duplicator.js.map +1 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/id-mapping.d.ts +3 -0
- package/dist/id-mapping.d.ts.map +1 -1
- package/dist/id-mapping.js +3 -0
- package/dist/id-mapping.js.map +1 -1
- package/dist/serializer.d.ts.map +1 -1
- package/dist/textualizer.d.ts +1 -1
- package/dist/textualizer.d.ts.map +1 -1
- package/dist/value-managers/annotations.d.ts +5 -0
- package/dist/value-managers/annotations.d.ts.map +1 -1
- package/dist/value-managers/annotations.js +30 -1
- package/dist/value-managers/annotations.js.map +1 -1
- package/dist/value-managers/base.d.ts.map +1 -1
- package/dist/value-managers/containments.d.ts +3 -0
- package/dist/value-managers/containments.d.ts.map +1 -1
- package/dist/value-managers/containments.js +78 -8
- package/dist/value-managers/containments.js.map +1 -1
- package/dist/value-managers/properties.js.map +1 -1
- package/dist/value-managers/references.d.ts +3 -0
- package/dist/value-managers/references.d.ts.map +1 -1
- package/dist/value-managers/references.js +26 -8
- package/dist/value-managers/references.js.map +1 -1
- package/package.json +4 -7
- package/src/base-types.ts +0 -1
- package/src/deltas/appliers.ts +370 -174
- package/src/deltas/inverters.ts +82 -34
- package/src/deltas/serialization/deserializer.g.ts +191 -62
- package/src/deltas/serialization/serializer.g.ts +242 -63
- package/src/deltas/serialization/types.g.ts +190 -51
- package/src/deltas/types.g.ts +190 -51
- package/src/deserializer.ts +7 -5
- package/src/duplicator.ts +1 -1
- package/src/id-mapping.ts +3 -0
- package/src/value-managers/annotations.ts +26 -0
- package/src/value-managers/containments.ts +73 -8
- package/src/value-managers/references.ts +28 -8
package/src/deltas/inverters.ts
CHANGED
|
@@ -18,23 +18,36 @@
|
|
|
18
18
|
import {
|
|
19
19
|
AnnotationAddedDelta,
|
|
20
20
|
AnnotationDeletedDelta,
|
|
21
|
+
AnnotationMovedAndReplacedFromOtherParentDelta,
|
|
22
|
+
AnnotationMovedAndReplacedInSameParentDelta,
|
|
21
23
|
AnnotationMovedFromOtherParentDelta,
|
|
22
24
|
AnnotationMovedInSameParentDelta,
|
|
23
25
|
AnnotationReplacedDelta,
|
|
24
26
|
ChildAddedDelta,
|
|
25
27
|
ChildDeletedDelta,
|
|
26
|
-
|
|
28
|
+
ChildMovedAndReplacedFromOtherContainmentDelta,
|
|
29
|
+
ChildMovedAndReplacedFromOtherContainmentInSameParentDelta,
|
|
30
|
+
ChildMovedAndReplacedInSameContainmentDelta,
|
|
31
|
+
ChildMovedFromOtherContainmentDelta,
|
|
32
|
+
ChildMovedFromOtherContainmentInSameParentDelta,
|
|
27
33
|
ChildMovedInSameContainmentDelta,
|
|
28
34
|
ChildReplacedDelta,
|
|
35
|
+
CompositeDelta,
|
|
36
|
+
EntryMovedAndReplacedFromOtherReferenceDelta,
|
|
37
|
+
EntryMovedAndReplacedFromOtherReferenceInSameParentDelta,
|
|
38
|
+
EntryMovedAndReplacedInSameReferenceDelta,
|
|
39
|
+
EntryMovedFromOtherReferenceDelta,
|
|
40
|
+
EntryMovedFromOtherReferenceInSameParentDelta,
|
|
41
|
+
EntryMovedInSameReferenceDelta,
|
|
29
42
|
NoOpDelta,
|
|
43
|
+
PartitionAddedDelta,
|
|
44
|
+
PartitionDeletedDelta,
|
|
30
45
|
PropertyAddedDelta,
|
|
31
46
|
PropertyChangedDelta,
|
|
32
47
|
PropertyDeletedDelta,
|
|
33
48
|
ReferenceAddedDelta,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ReferenceMovedInSameReferenceDelta,
|
|
37
|
-
ReferenceReplacedDelta
|
|
49
|
+
ReferenceChangedDelta,
|
|
50
|
+
ReferenceDeletedDelta
|
|
38
51
|
} from "./types.g.js"
|
|
39
52
|
import { IDelta } from "./base.js"
|
|
40
53
|
|
|
@@ -44,52 +57,48 @@ import { IDelta } from "./base.js"
|
|
|
44
57
|
* in the sense that it undoes that delta after it has been applied.
|
|
45
58
|
*/
|
|
46
59
|
export const invertDelta = (delta: IDelta): IDelta => {
|
|
47
|
-
if (delta instanceof
|
|
48
|
-
return delta;
|
|
60
|
+
if (delta instanceof PartitionAddedDelta) {
|
|
61
|
+
return new PartitionDeletedDelta(delta.newPartition);
|
|
49
62
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return new PropertyDeletedDelta(delta.container, delta.property, delta.value);
|
|
63
|
+
if (delta instanceof PartitionDeletedDelta) {
|
|
64
|
+
return new PartitionAddedDelta(delta.deletedPartition);
|
|
53
65
|
}
|
|
54
|
-
if (delta instanceof
|
|
55
|
-
return new
|
|
66
|
+
if (delta instanceof PropertyAddedDelta) {
|
|
67
|
+
return new PropertyDeletedDelta(delta.node, delta.property, delta.value);
|
|
56
68
|
}
|
|
57
69
|
if (delta instanceof PropertyDeletedDelta) {
|
|
58
|
-
return new PropertyAddedDelta(delta.
|
|
70
|
+
return new PropertyAddedDelta(delta.node, delta.property, delta.oldValue);
|
|
71
|
+
}
|
|
72
|
+
if (delta instanceof PropertyChangedDelta) {
|
|
73
|
+
return new PropertyChangedDelta(delta.node, delta.property, delta.newValue, delta.oldValue);
|
|
59
74
|
}
|
|
60
|
-
|
|
61
75
|
if (delta instanceof ChildAddedDelta) {
|
|
62
76
|
return new ChildDeletedDelta(delta.parent, delta.containment, delta.index, delta.newChild);
|
|
63
77
|
}
|
|
78
|
+
if (delta instanceof ChildDeletedDelta) {
|
|
79
|
+
return new ChildAddedDelta(delta.parent, delta.containment, delta.index, delta.deletedChild);
|
|
80
|
+
}
|
|
64
81
|
if (delta instanceof ChildReplacedDelta) {
|
|
65
82
|
return new ChildReplacedDelta(delta.parent, delta.containment, delta.index, delta.newChild, delta.replacedChild);
|
|
66
83
|
}
|
|
67
|
-
if (delta instanceof
|
|
68
|
-
return new
|
|
84
|
+
if (delta instanceof ChildMovedFromOtherContainmentDelta) {
|
|
85
|
+
return new ChildMovedFromOtherContainmentDelta(delta.newParent, delta.newContainment, delta.newIndex, delta.oldParent, delta.oldContainment, delta.oldIndex, delta.movedChild);
|
|
69
86
|
}
|
|
70
|
-
if (delta instanceof
|
|
71
|
-
return new
|
|
72
|
-
}
|
|
73
|
-
if (delta instanceof ChildDeletedDelta) {
|
|
74
|
-
return new ChildAddedDelta(delta.parent, delta.containment, delta.index, delta.deletedChild);
|
|
87
|
+
if (delta instanceof ChildMovedFromOtherContainmentInSameParentDelta) {
|
|
88
|
+
return new ChildMovedFromOtherContainmentInSameParentDelta(delta.parent, delta.newContainment, delta.newIndex, delta.movedChild, delta.oldContainment, delta.oldIndex);
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return new ReferenceDeletedDelta(delta.container, delta.reference, delta.index, delta.newTarget);
|
|
90
|
+
if (delta instanceof ChildMovedInSameContainmentDelta) {
|
|
91
|
+
return new ChildMovedInSameContainmentDelta(delta.parent, delta.containment, delta.newIndex, delta.oldIndex, delta.movedChild);
|
|
79
92
|
}
|
|
80
|
-
if (delta instanceof
|
|
81
|
-
|
|
93
|
+
if (delta instanceof ChildMovedAndReplacedFromOtherContainmentDelta) {
|
|
94
|
+
// TODO implement
|
|
82
95
|
}
|
|
83
|
-
if (delta instanceof
|
|
84
|
-
|
|
96
|
+
if (delta instanceof ChildMovedAndReplacedFromOtherContainmentInSameParentDelta) {
|
|
97
|
+
// TODO implement
|
|
85
98
|
}
|
|
86
|
-
if (delta instanceof
|
|
87
|
-
|
|
99
|
+
if (delta instanceof ChildMovedAndReplacedInSameContainmentDelta) {
|
|
100
|
+
// TODO implement
|
|
88
101
|
}
|
|
89
|
-
if (delta instanceof ReferenceDeletedDelta) {
|
|
90
|
-
return new ReferenceAddedDelta(delta.container, delta.reference, delta.index, delta.deletedTarget);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
102
|
if (delta instanceof AnnotationAddedDelta) {
|
|
94
103
|
return new AnnotationDeletedDelta(delta.parent, delta.index, delta.newAnnotation);
|
|
95
104
|
}
|
|
@@ -105,6 +114,45 @@ export const invertDelta = (delta: IDelta): IDelta => {
|
|
|
105
114
|
if (delta instanceof AnnotationMovedInSameParentDelta) {
|
|
106
115
|
return new AnnotationMovedInSameParentDelta(delta.parent, delta.newIndex, delta.oldIndex, delta.movedAnnotation);
|
|
107
116
|
}
|
|
117
|
+
if (delta instanceof AnnotationMovedAndReplacedFromOtherParentDelta) {
|
|
118
|
+
// TODO implement
|
|
119
|
+
}
|
|
120
|
+
if (delta instanceof AnnotationMovedAndReplacedInSameParentDelta) {
|
|
121
|
+
// TODO implement
|
|
122
|
+
}
|
|
123
|
+
if (delta instanceof ReferenceAddedDelta) {
|
|
124
|
+
return new ReferenceDeletedDelta(delta.parent, delta.reference, delta.index, delta.newTarget);
|
|
125
|
+
}
|
|
126
|
+
if (delta instanceof ReferenceDeletedDelta) {
|
|
127
|
+
return new ReferenceAddedDelta(delta.parent, delta.reference, delta.index, delta.deletedTarget);
|
|
128
|
+
}
|
|
129
|
+
if (delta instanceof ReferenceChangedDelta) {
|
|
130
|
+
return new ReferenceChangedDelta(delta.parent, delta.reference, delta.index, delta.oldTarget, delta.newTarget);
|
|
131
|
+
}
|
|
132
|
+
if (delta instanceof EntryMovedFromOtherReferenceDelta) {
|
|
133
|
+
return new EntryMovedFromOtherReferenceDelta(delta.newParent, delta.newReference, delta.newIndex, delta.oldParent, delta.oldReference, delta.oldIndex, delta.movedTarget);
|
|
134
|
+
}
|
|
135
|
+
if (delta instanceof EntryMovedFromOtherReferenceInSameParentDelta) {
|
|
136
|
+
// TODO implement
|
|
137
|
+
}
|
|
138
|
+
if (delta instanceof EntryMovedInSameReferenceDelta) {
|
|
139
|
+
return new EntryMovedInSameReferenceDelta(delta.parent, delta.reference, delta.newIndex, delta.oldIndex, delta.movedTarget);
|
|
140
|
+
}
|
|
141
|
+
if (delta instanceof EntryMovedAndReplacedFromOtherReferenceDelta) {
|
|
142
|
+
// TODO implement
|
|
143
|
+
}
|
|
144
|
+
if (delta instanceof EntryMovedAndReplacedFromOtherReferenceInSameParentDelta) {
|
|
145
|
+
return new EntryMovedAndReplacedFromOtherReferenceInSameParentDelta(delta.parent, delta.newReference, delta.newIndex, delta.oldReference, delta.oldIndex, delta.replacedTarget, delta.movedTarget);
|
|
146
|
+
}
|
|
147
|
+
if (delta instanceof EntryMovedAndReplacedInSameReferenceDelta) {
|
|
148
|
+
// TODO implement
|
|
149
|
+
}
|
|
150
|
+
if (delta instanceof CompositeDelta) {
|
|
151
|
+
return new CompositeDelta(delta.parts.map(invertDelta));
|
|
152
|
+
}
|
|
153
|
+
if (delta instanceof NoOpDelta) {
|
|
154
|
+
return delta;
|
|
155
|
+
}
|
|
108
156
|
|
|
109
157
|
throw new Error(`inversion of delta of class ${delta.constructor.name} not implemented`);
|
|
110
158
|
}
|
|
@@ -19,139 +19,164 @@
|
|
|
19
19
|
// Modifying it by hand is useless at best, and sabotage at worst.
|
|
20
20
|
|
|
21
21
|
import { Containment, MemoisingSymbolTable, Property, Reference } from "@lionweb/core";
|
|
22
|
+
import { LionWebJsonMetaPointer } from "@lionweb/json";
|
|
22
23
|
|
|
23
|
-
import { ILanguageBase } from "../../base-types.js";
|
|
24
|
+
import { ILanguageBase, INodeBase } from "../../base-types.js";
|
|
24
25
|
import { IdMapping } from "../../id-mapping.js";
|
|
25
26
|
import { SerializedDelta } from "./types.g.js";
|
|
26
27
|
import { DeltaDeserializer } from "./base.js";
|
|
27
28
|
import {
|
|
28
29
|
AnnotationAddedDelta,
|
|
29
30
|
AnnotationDeletedDelta,
|
|
31
|
+
AnnotationMovedAndReplacedFromOtherParentDelta,
|
|
32
|
+
AnnotationMovedAndReplacedInSameParentDelta,
|
|
30
33
|
AnnotationMovedFromOtherParentDelta,
|
|
31
34
|
AnnotationMovedInSameParentDelta,
|
|
32
35
|
AnnotationReplacedDelta,
|
|
33
36
|
ChildAddedDelta,
|
|
34
37
|
ChildDeletedDelta,
|
|
35
|
-
|
|
38
|
+
ChildMovedAndReplacedFromOtherContainmentDelta,
|
|
39
|
+
ChildMovedAndReplacedFromOtherContainmentInSameParentDelta,
|
|
40
|
+
ChildMovedAndReplacedInSameContainmentDelta,
|
|
41
|
+
ChildMovedFromOtherContainmentDelta,
|
|
42
|
+
ChildMovedFromOtherContainmentInSameParentDelta,
|
|
36
43
|
ChildMovedInSameContainmentDelta,
|
|
37
44
|
ChildReplacedDelta,
|
|
45
|
+
CompositeDelta,
|
|
46
|
+
EntryMovedAndReplacedFromOtherReferenceDelta,
|
|
47
|
+
EntryMovedAndReplacedFromOtherReferenceInSameParentDelta,
|
|
48
|
+
EntryMovedAndReplacedInSameReferenceDelta,
|
|
49
|
+
EntryMovedFromOtherReferenceDelta,
|
|
50
|
+
EntryMovedFromOtherReferenceInSameParentDelta,
|
|
51
|
+
EntryMovedInSameReferenceDelta,
|
|
38
52
|
NoOpDelta,
|
|
53
|
+
PartitionAddedDelta,
|
|
54
|
+
PartitionDeletedDelta,
|
|
39
55
|
PropertyAddedDelta,
|
|
40
56
|
PropertyChangedDelta,
|
|
41
57
|
PropertyDeletedDelta,
|
|
42
58
|
ReferenceAddedDelta,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
ReferenceMovedInSameReferenceDelta,
|
|
46
|
-
ReferenceReplacedDelta
|
|
59
|
+
ReferenceChangedDelta,
|
|
60
|
+
ReferenceDeletedDelta
|
|
47
61
|
} from "../types.g.js";
|
|
62
|
+
import { IDelta } from "../base.js";
|
|
48
63
|
|
|
49
64
|
|
|
50
65
|
export const deltaDeserializer = (languageBases: ILanguageBase[], idMapping: IdMapping): DeltaDeserializer => {
|
|
51
66
|
const symbolTable = new MemoisingSymbolTable(languageBases.map(({language}) => language));
|
|
52
|
-
|
|
67
|
+
const resolvedPropertyFrom = (metaPointer: LionWebJsonMetaPointer, container: INodeBase): Property =>
|
|
68
|
+
symbolTable.featureMatching(container.classifier.metaPointer(), metaPointer) as Property
|
|
69
|
+
const resolvedContainmentFrom = (metaPointer: LionWebJsonMetaPointer, container: INodeBase): Containment =>
|
|
70
|
+
symbolTable.featureMatching(container.classifier.metaPointer(), metaPointer) as Containment
|
|
71
|
+
const resolvedReferenceFrom = (metaPointer: LionWebJsonMetaPointer, container: INodeBase): Reference =>
|
|
72
|
+
symbolTable.featureMatching(container.classifier.metaPointer(), metaPointer) as Reference
|
|
73
|
+
const deserializedDelta = (delta: SerializedDelta): IDelta => {
|
|
53
74
|
switch (delta.kind) {
|
|
54
|
-
case "
|
|
55
|
-
|
|
75
|
+
case "PartitionAdded": {
|
|
76
|
+
const newPartition = idMapping.fromId(delta.newPartition);
|
|
77
|
+
return new PartitionAddedDelta(newPartition);
|
|
78
|
+
}
|
|
79
|
+
case "PartitionDeleted": {
|
|
80
|
+
const deletedPartition = idMapping.fromId(delta.deletedPartition);
|
|
81
|
+
return new PartitionDeletedDelta(deletedPartition);
|
|
56
82
|
}
|
|
57
83
|
case "PropertyAdded": {
|
|
58
|
-
const
|
|
59
|
-
const property =
|
|
84
|
+
const node = idMapping.fromId(delta.node);
|
|
85
|
+
const property = resolvedPropertyFrom(delta.property, node);
|
|
60
86
|
const value = delta.value;
|
|
61
|
-
return new PropertyAddedDelta(
|
|
87
|
+
return new PropertyAddedDelta(node, property, value);
|
|
62
88
|
}
|
|
63
89
|
case "PropertyDeleted": {
|
|
64
|
-
const
|
|
65
|
-
const property =
|
|
90
|
+
const node = idMapping.fromId(delta.node);
|
|
91
|
+
const property = resolvedPropertyFrom(delta.property, node);
|
|
66
92
|
const oldValue = delta.oldValue;
|
|
67
|
-
return new PropertyDeletedDelta(
|
|
93
|
+
return new PropertyDeletedDelta(node, property, oldValue);
|
|
68
94
|
}
|
|
69
95
|
case "PropertyChanged": {
|
|
70
|
-
const
|
|
71
|
-
const property =
|
|
96
|
+
const node = idMapping.fromId(delta.node);
|
|
97
|
+
const property = resolvedPropertyFrom(delta.property, node);
|
|
72
98
|
const oldValue = delta.oldValue;
|
|
73
99
|
const newValue = delta.newValue;
|
|
74
|
-
return new PropertyChangedDelta(
|
|
100
|
+
return new PropertyChangedDelta(node, property, oldValue, newValue);
|
|
75
101
|
}
|
|
76
102
|
case "ChildAdded": {
|
|
77
103
|
const parent = idMapping.fromId(delta.parent);
|
|
78
|
-
const containment =
|
|
104
|
+
const containment = resolvedContainmentFrom(delta.containment, parent);
|
|
79
105
|
const index = delta.index;
|
|
80
106
|
const newChild = idMapping.fromId(delta.newChild);
|
|
81
107
|
return new ChildAddedDelta(parent, containment, index, newChild);
|
|
82
108
|
}
|
|
83
109
|
case "ChildDeleted": {
|
|
84
110
|
const parent = idMapping.fromId(delta.parent);
|
|
85
|
-
const containment =
|
|
111
|
+
const containment = resolvedContainmentFrom(delta.containment, parent);
|
|
86
112
|
const index = delta.index;
|
|
87
113
|
const deletedChild = idMapping.fromId(delta.deletedChild);
|
|
88
114
|
return new ChildDeletedDelta(parent, containment, index, deletedChild);
|
|
89
115
|
}
|
|
90
116
|
case "ChildReplaced": {
|
|
91
117
|
const parent = idMapping.fromId(delta.parent);
|
|
92
|
-
const containment =
|
|
118
|
+
const containment = resolvedContainmentFrom(delta.containment, parent);
|
|
93
119
|
const index = delta.index;
|
|
94
120
|
const replacedChild = idMapping.fromId(delta.replacedChild);
|
|
95
121
|
const newChild = idMapping.fromId(delta.newChild);
|
|
96
122
|
return new ChildReplacedDelta(parent, containment, index, replacedChild, newChild);
|
|
97
123
|
}
|
|
98
|
-
case "
|
|
124
|
+
case "ChildMovedFromOtherContainment": {
|
|
99
125
|
const oldParent = idMapping.fromId(delta.oldParent);
|
|
100
|
-
const oldContainment =
|
|
126
|
+
const oldContainment = resolvedContainmentFrom(delta.oldContainment, oldParent);
|
|
101
127
|
const oldIndex = delta.oldIndex;
|
|
102
128
|
const newParent = idMapping.fromId(delta.newParent);
|
|
103
|
-
const newContainment =
|
|
129
|
+
const newContainment = resolvedContainmentFrom(delta.newContainment, newParent);
|
|
104
130
|
const newIndex = delta.newIndex;
|
|
105
|
-
const
|
|
106
|
-
return new
|
|
131
|
+
const movedChild = idMapping.fromId(delta.movedChild);
|
|
132
|
+
return new ChildMovedFromOtherContainmentDelta(oldParent, oldContainment, oldIndex, newParent, newContainment, newIndex, movedChild);
|
|
107
133
|
}
|
|
108
|
-
case "
|
|
134
|
+
case "ChildMovedFromOtherContainmentInSameParent": {
|
|
109
135
|
const parent = idMapping.fromId(delta.parent);
|
|
110
|
-
const
|
|
136
|
+
const oldContainment = resolvedContainmentFrom(delta.oldContainment, parent);
|
|
111
137
|
const oldIndex = delta.oldIndex;
|
|
138
|
+
const movedChild = idMapping.fromId(delta.movedChild);
|
|
139
|
+
const newContainment = resolvedContainmentFrom(delta.newContainment, parent);
|
|
112
140
|
const newIndex = delta.newIndex;
|
|
113
|
-
|
|
114
|
-
return new ChildMovedInSameContainmentDelta(parent, containment, oldIndex, newIndex, child);
|
|
141
|
+
return new ChildMovedFromOtherContainmentInSameParentDelta(parent, oldContainment, oldIndex, movedChild, newContainment, newIndex);
|
|
115
142
|
}
|
|
116
|
-
case "
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
case "ReferenceDeleted": {
|
|
124
|
-
const container = idMapping.fromId(delta.container);
|
|
125
|
-
const reference = symbolTable.featureMatching(container.classifier.metaPointer(), delta.reference) as Reference;
|
|
126
|
-
const index = delta.index;
|
|
127
|
-
const deletedTarget = idMapping.fromRefId(delta.deletedTarget);
|
|
128
|
-
return new ReferenceDeletedDelta(container, reference, index, deletedTarget);
|
|
143
|
+
case "ChildMovedInSameContainment": {
|
|
144
|
+
const parent = idMapping.fromId(delta.parent);
|
|
145
|
+
const containment = resolvedContainmentFrom(delta.containment, parent);
|
|
146
|
+
const oldIndex = delta.oldIndex;
|
|
147
|
+
const newIndex = delta.newIndex;
|
|
148
|
+
const movedChild = idMapping.fromId(delta.movedChild);
|
|
149
|
+
return new ChildMovedInSameContainmentDelta(parent, containment, oldIndex, newIndex, movedChild);
|
|
129
150
|
}
|
|
130
|
-
case "
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
|
|
151
|
+
case "ChildMovedAndReplacedFromOtherContainment": {
|
|
152
|
+
const newParent = idMapping.fromId(delta.newParent);
|
|
153
|
+
const newContainment = resolvedContainmentFrom(delta.newContainment, newParent);
|
|
154
|
+
const newIndex = delta.newIndex;
|
|
155
|
+
const movedChild = idMapping.fromId(delta.movedChild);
|
|
156
|
+
const oldParent = idMapping.fromId(delta.oldParent);
|
|
157
|
+
const oldContainment = resolvedContainmentFrom(delta.oldContainment, oldParent);
|
|
158
|
+
const oldIndex = delta.oldIndex;
|
|
159
|
+
const replacedChild = idMapping.fromId(delta.replacedChild);
|
|
160
|
+
return new ChildMovedAndReplacedFromOtherContainmentDelta(newParent, newContainment, newIndex, movedChild, oldParent, oldContainment, oldIndex, replacedChild);
|
|
137
161
|
}
|
|
138
|
-
case "
|
|
139
|
-
const
|
|
140
|
-
const
|
|
162
|
+
case "ChildMovedAndReplacedFromOtherContainmentInSameParent": {
|
|
163
|
+
const parent = idMapping.fromId(delta.parent);
|
|
164
|
+
const oldContainment = resolvedContainmentFrom(delta.oldContainment, parent);
|
|
141
165
|
const oldIndex = delta.oldIndex;
|
|
142
|
-
const
|
|
143
|
-
const newReference = symbolTable.featureMatching(newContainer.classifier.metaPointer(), delta.newReference) as Reference;
|
|
166
|
+
const newContainment = resolvedContainmentFrom(delta.newContainment, parent);
|
|
144
167
|
const newIndex = delta.newIndex;
|
|
145
|
-
const
|
|
146
|
-
|
|
168
|
+
const movedChild = idMapping.fromId(delta.movedChild);
|
|
169
|
+
const replacedChild = idMapping.fromId(delta.replacedChild);
|
|
170
|
+
return new ChildMovedAndReplacedFromOtherContainmentInSameParentDelta(parent, oldContainment, oldIndex, newContainment, newIndex, movedChild, replacedChild);
|
|
147
171
|
}
|
|
148
|
-
case "
|
|
149
|
-
const
|
|
150
|
-
const
|
|
172
|
+
case "ChildMovedAndReplacedInSameContainment": {
|
|
173
|
+
const parent = idMapping.fromId(delta.parent);
|
|
174
|
+
const containment = resolvedContainmentFrom(delta.containment, parent);
|
|
151
175
|
const oldIndex = delta.oldIndex;
|
|
152
176
|
const newIndex = delta.newIndex;
|
|
153
|
-
const
|
|
154
|
-
|
|
177
|
+
const movedChild = idMapping.fromId(delta.movedChild);
|
|
178
|
+
const replacedChild = idMapping.fromId(delta.replacedChild);
|
|
179
|
+
return new ChildMovedAndReplacedInSameContainmentDelta(parent, containment, oldIndex, newIndex, movedChild, replacedChild);
|
|
155
180
|
}
|
|
156
181
|
case "AnnotationAdded": {
|
|
157
182
|
const parent = idMapping.fromId(delta.parent);
|
|
@@ -187,7 +212,111 @@ export const deltaDeserializer = (languageBases: ILanguageBase[], idMapping: IdM
|
|
|
187
212
|
const movedAnnotation = idMapping.fromId(delta.movedAnnotation);
|
|
188
213
|
return new AnnotationMovedInSameParentDelta(parent, oldIndex, newIndex, movedAnnotation);
|
|
189
214
|
}
|
|
215
|
+
case "AnnotationMovedAndReplacedFromOtherParent": {
|
|
216
|
+
const oldParent = idMapping.fromId(delta.oldParent);
|
|
217
|
+
const oldIndex = delta.oldIndex;
|
|
218
|
+
const replacedAnnotation = idMapping.fromId(delta.replacedAnnotation);
|
|
219
|
+
const newParent = idMapping.fromId(delta.newParent);
|
|
220
|
+
const newIndex = delta.newIndex;
|
|
221
|
+
const movedAnnotation = idMapping.fromId(delta.movedAnnotation);
|
|
222
|
+
return new AnnotationMovedAndReplacedFromOtherParentDelta(oldParent, oldIndex, replacedAnnotation, newParent, newIndex, movedAnnotation);
|
|
223
|
+
}
|
|
224
|
+
case "AnnotationMovedAndReplacedInSameParent": {
|
|
225
|
+
const parent = idMapping.fromId(delta.parent);
|
|
226
|
+
const oldIndex = delta.oldIndex;
|
|
227
|
+
const newIndex = delta.newIndex;
|
|
228
|
+
const replacedAnnotation = idMapping.fromId(delta.replacedAnnotation);
|
|
229
|
+
const movedAnnotation = idMapping.fromId(delta.movedAnnotation);
|
|
230
|
+
return new AnnotationMovedAndReplacedInSameParentDelta(parent, oldIndex, newIndex, replacedAnnotation, movedAnnotation);
|
|
231
|
+
}
|
|
232
|
+
case "ReferenceAdded": {
|
|
233
|
+
const parent = idMapping.fromId(delta.parent);
|
|
234
|
+
const reference = resolvedReferenceFrom(delta.reference, parent);
|
|
235
|
+
const index = delta.index;
|
|
236
|
+
const newTarget = idMapping.fromRefId(delta.newTarget);
|
|
237
|
+
return new ReferenceAddedDelta(parent, reference, index, newTarget);
|
|
238
|
+
}
|
|
239
|
+
case "ReferenceDeleted": {
|
|
240
|
+
const parent = idMapping.fromId(delta.parent);
|
|
241
|
+
const reference = resolvedReferenceFrom(delta.reference, parent);
|
|
242
|
+
const index = delta.index;
|
|
243
|
+
const deletedTarget = idMapping.fromRefId(delta.deletedTarget);
|
|
244
|
+
return new ReferenceDeletedDelta(parent, reference, index, deletedTarget);
|
|
245
|
+
}
|
|
246
|
+
case "ReferenceChanged": {
|
|
247
|
+
const parent = idMapping.fromId(delta.parent);
|
|
248
|
+
const reference = resolvedReferenceFrom(delta.reference, parent);
|
|
249
|
+
const index = delta.index;
|
|
250
|
+
const newTarget = idMapping.fromRefId(delta.newTarget);
|
|
251
|
+
const oldTarget = idMapping.fromRefId(delta.oldTarget);
|
|
252
|
+
return new ReferenceChangedDelta(parent, reference, index, newTarget, oldTarget);
|
|
253
|
+
}
|
|
254
|
+
case "EntryMovedFromOtherReference": {
|
|
255
|
+
const oldParent = idMapping.fromId(delta.oldParent);
|
|
256
|
+
const oldReference = resolvedReferenceFrom(delta.oldReference, oldParent);
|
|
257
|
+
const oldIndex = delta.oldIndex;
|
|
258
|
+
const newParent = idMapping.fromId(delta.newParent);
|
|
259
|
+
const newReference = resolvedReferenceFrom(delta.newReference, newParent);
|
|
260
|
+
const newIndex = delta.newIndex;
|
|
261
|
+
const movedTarget = idMapping.fromRefId(delta.movedTarget);
|
|
262
|
+
return new EntryMovedFromOtherReferenceDelta(oldParent, oldReference, oldIndex, newParent, newReference, newIndex, movedTarget);
|
|
263
|
+
}
|
|
264
|
+
case "EntryMovedFromOtherReferenceInSameParent": {
|
|
265
|
+
const parent = idMapping.fromId(delta.parent);
|
|
266
|
+
const oldReference = resolvedReferenceFrom(delta.oldReference, parent);
|
|
267
|
+
const oldIndex = delta.oldIndex;
|
|
268
|
+
const newReference = resolvedReferenceFrom(delta.newReference, parent);
|
|
269
|
+
const newIndex = delta.newIndex;
|
|
270
|
+
const movedTarget = idMapping.fromRefId(delta.movedTarget);
|
|
271
|
+
return new EntryMovedFromOtherReferenceInSameParentDelta(parent, oldReference, oldIndex, newReference, newIndex, movedTarget);
|
|
272
|
+
}
|
|
273
|
+
case "EntryMovedInSameReference": {
|
|
274
|
+
const parent = idMapping.fromId(delta.parent);
|
|
275
|
+
const reference = resolvedReferenceFrom(delta.reference, parent);
|
|
276
|
+
const oldIndex = delta.oldIndex;
|
|
277
|
+
const newIndex = delta.newIndex;
|
|
278
|
+
const movedTarget = idMapping.fromRefId(delta.movedTarget);
|
|
279
|
+
return new EntryMovedInSameReferenceDelta(parent, reference, oldIndex, newIndex, movedTarget);
|
|
280
|
+
}
|
|
281
|
+
case "EntryMovedAndReplacedFromOtherReference": {
|
|
282
|
+
const newParent = idMapping.fromId(delta.newParent);
|
|
283
|
+
const newReference = resolvedReferenceFrom(delta.newReference, newParent);
|
|
284
|
+
const newIndex = delta.newIndex;
|
|
285
|
+
const movedTarget = idMapping.fromRefId(delta.movedTarget);
|
|
286
|
+
const oldParent = idMapping.fromId(delta.oldParent);
|
|
287
|
+
const oldReference = resolvedReferenceFrom(delta.oldReference, oldParent);
|
|
288
|
+
const oldIndex = delta.oldIndex;
|
|
289
|
+
const replacedTarget = idMapping.fromRefId(delta.replacedTarget);
|
|
290
|
+
return new EntryMovedAndReplacedFromOtherReferenceDelta(newParent, newReference, newIndex, movedTarget, oldParent, oldReference, oldIndex, replacedTarget);
|
|
291
|
+
}
|
|
292
|
+
case "EntryMovedAndReplacedFromOtherReferenceInSameParent": {
|
|
293
|
+
const parent = idMapping.fromId(delta.parent);
|
|
294
|
+
const oldReference = resolvedReferenceFrom(delta.oldReference, parent);
|
|
295
|
+
const oldIndex = delta.oldIndex;
|
|
296
|
+
const newReference = resolvedReferenceFrom(delta.newReference, parent);
|
|
297
|
+
const newIndex = delta.newIndex;
|
|
298
|
+
const movedTarget = idMapping.fromRefId(delta.movedTarget);
|
|
299
|
+
const replacedTarget = idMapping.fromRefId(delta.replacedTarget);
|
|
300
|
+
return new EntryMovedAndReplacedFromOtherReferenceInSameParentDelta(parent, oldReference, oldIndex, newReference, newIndex, movedTarget, replacedTarget);
|
|
301
|
+
}
|
|
302
|
+
case "EntryMovedAndReplacedInSameReference": {
|
|
303
|
+
const parent = idMapping.fromId(delta.parent);
|
|
304
|
+
const reference = resolvedReferenceFrom(delta.reference, parent);
|
|
305
|
+
const oldIndex = delta.oldIndex;
|
|
306
|
+
const newIndex = delta.newIndex;
|
|
307
|
+
const movedTarget = idMapping.fromRefId(delta.movedTarget);
|
|
308
|
+
const replacedTarget = idMapping.fromRefId(delta.replacedTarget);
|
|
309
|
+
return new EntryMovedAndReplacedInSameReferenceDelta(parent, reference, oldIndex, newIndex, movedTarget, replacedTarget);
|
|
310
|
+
}
|
|
311
|
+
case "Composite": {
|
|
312
|
+
const parts = delta.parts.map(deserializedDelta);
|
|
313
|
+
return new CompositeDelta(parts);
|
|
314
|
+
}
|
|
315
|
+
case "NoOp": {
|
|
316
|
+
return new NoOpDelta();
|
|
317
|
+
}
|
|
190
318
|
}
|
|
191
319
|
}
|
|
320
|
+
return deserializedDelta;
|
|
192
321
|
}
|
|
193
322
|
|