|
@@ -51,7 +51,6 @@ export class TrivialParser implements Parser, Renderer {
|
|
|
// We can use pretty much the same code for both parsing and rendering :)
|
|
|
propagate_change(parse: boolean, sourceComposite: CompositeDelta, sourceParent: Version, corrParent: Version, targetParent: Version) {
|
|
|
const sourceDeltas = [...sourceComposite.iterPrimitiveDeltas()];
|
|
|
- const parentCorrDeltas = new Set(corrParent.iterPrimitiveDeltas());
|
|
|
|
|
|
const targetDeltas: Delta[] = [];
|
|
|
const corrDeltas: Delta[] = [];
|
|
@@ -78,22 +77,6 @@ export class TrivialParser implements Parser, Renderer {
|
|
|
const sourceDeletion = sourceDelta; // alias for readability :)
|
|
|
const sourceCreation = sourceDeletion.creation; // the NodeCreation of the deleted cs node
|
|
|
|
|
|
- // // sourceDeletion will conflict with our earlier 'corr2Source' EdgeCreation delta:
|
|
|
- // const corr2Source = sourceDeletion.edgeTargetConflicts.find(e => parentCorrDeltas.has(e));
|
|
|
- // if (corr2Source === undefined) {
|
|
|
- // throw new Error("Assertion failed: When a node is deleted, the deletion must be conflicting with the creation of an incoming correspondence edge.");
|
|
|
- // }
|
|
|
- // const corrCreation = corr2Source.getCreation().source;
|
|
|
- // // corrCreation will have only one other outgoing edge:
|
|
|
- // const corr2Target = corrCreation.outgoingEdges.find(e => e !== corr2Source);
|
|
|
- // if (corr2Target === undefined) {
|
|
|
- // throw new Error("Assertion failed: The correspondence node must have two outgoing edges, one to CS and one to AS.");
|
|
|
- // }
|
|
|
- // const targetCreation = corr2Target.target.getTarget();
|
|
|
- // if (! (targetCreation instanceof NodeCreation)) {
|
|
|
- // throw new Error("Assertion failed: The target of corr2Target must be the NodeCreation of the AS node.");
|
|
|
- // }
|
|
|
-
|
|
|
// edge from corrspondence node to CS node:
|
|
|
const corr2Source = sourceCreation.incomingEdges.find(delta => delta instanceof EdgeCreation && delta.label === corr2SourceLabel);
|
|
|
if (corr2Source === undefined || !(corr2Source instanceof EdgeCreation)) {
|
|
@@ -119,26 +102,12 @@ export class TrivialParser implements Parser, Renderer {
|
|
|
const targetDeletion = getDeltasForDelete(this.primitiveRegistry, targetCreation, targetParent);
|
|
|
const targetDeletion1 = getDeltasForDelete(this.primitiveRegistry, targetCreation, corrParent, corrDeletion);
|
|
|
|
|
|
- // const targetDeletion = new NodeDeletion(targetCreation, [], []); // only part of AS
|
|
|
- // const targetDeletion1 = new NodeDeletion(targetCreation, [], [corrDeletion]); // only part of CORR (override)
|
|
|
-
|
|
|
// We already have the deletion in the CS model, so we only need to create another one to be used in the CORR model:
|
|
|
const sourceDeletion1 = getDeltasForDelete(this.primitiveRegistry, sourceCreation, corrParent, corrDeletion);
|
|
|
- // const sourceDeletion1 = new NodeDeletion(sourceCreation,
|
|
|
- // sourceDeletion.deletedOutgoingEdges.map(d => corrParent.findOverride("cs", d) || d),
|
|
|
- // sourceDeletion.afterIncomingEdges.map(d => corrParent.findOverride("cs", d) || d).concat(corrDeletion));
|
|
|
|
|
|
sourceOverrides.set(sourceDeletion, sourceDeletion1[sourceDeletion1.length-1]);
|
|
|
targetOverrides.set(targetDeletion[targetDeletion.length-1], targetDeletion1[targetDeletion1.length-1]);
|
|
|
|
|
|
- console.log({
|
|
|
- targetDeletion,
|
|
|
- targetDeletion1,
|
|
|
- corrDeletion,
|
|
|
- sourceDeletion,
|
|
|
- sourceDeletion1,
|
|
|
- })
|
|
|
-
|
|
|
targetDeltas.push(...targetDeletion);
|
|
|
corrDeltas.push(...corrDeletion);
|
|
|
}
|
|
@@ -150,8 +119,6 @@ export class TrivialParser implements Parser, Renderer {
|
|
|
const sourceDeltas1 = sourceDeltas.map(d => sourceOverrides.get(d) || d);
|
|
|
const targetDeltas1 = targetDeltas.map(d => targetOverrides.get(d) || d);
|
|
|
|
|
|
- console.log({sourceDeltas1, targetDeltas1})
|
|
|
-
|
|
|
// the order in which corr-deltas are put in corrComposite matters - deltas must occur after their dependencies:
|
|
|
const orderedByDependency: Delta[] = [];
|
|
|
visitPartialOrdering(
|
|
@@ -170,7 +137,7 @@ export class TrivialParser implements Parser, Renderer {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- parse(csComposite: CompositeDelta, csParent: Version, corrParent: Version, asParent): ParseOrRenderResult {
|
|
|
+ parse(csComposite: CompositeDelta, csParent: Version, corrParent: Version, asParent: Version): ParseOrRenderResult {
|
|
|
const {
|
|
|
corrComposite,
|
|
|
targetComposite,
|