PcsMerger

com.phasmidsoftware.xmldoc.merge.PcsMerger
object PcsMerger

A structural merger over Pcs/Content relations - the reconciliation half of Lindholm's merge procedure ("A Three-way Merge for XML Documents", section 6: raw-merge-then-resolve- contradictions), applied to whatever PcsEditDetector finds. EditDetector/Merger still only reconcile attributes on already-matched nodes; this is what actually detects and merges a plain reorder, which they cannot (see PcsSpec/PcsEditDetectorSpec).

Checks all three of Lindholm's structural consistency rules: "unique successor" and "unique predecessor" (a node's position within its current parent's child list), and "unique parent" - a node claimed as a child by two genuinely different parents (e.g. Kaining's 10-group-ungroup), which the first two can't see: they only compare values sharing the same (parent, ...) key, but a node moved to a different parent changes which key it appears under at all, not the value at a shared one.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
PcsMerger.type

Members list

Value members

Concrete methods

def merge(base: GenericElement, left: GenericElement, right: GenericElement, ignoredAttributes: Set[String] = ..., leftLabel: NodeRef => String = ..., rightLabel: NodeRef => String = ...): StructuralMergeResult

Merges left and right, both relative to base.

Merges left and right, both relative to base.

Value parameters

base

the common ancestor.

ignoredAttributes

forwarded to PcsEditDetector.detectEdits - see there.

left

one independently modified version.

leftLabel

how to label left's nodes - forwarded to PcsEditDetector.detectEdits; pass ContentMatcher.matchedLabel(base, left) for a document type with no stable identity attribute (see mergeByContent, which does this).

right

the other independently modified version.

rightLabel

the same, for right.

Attributes

Returns

the resolved relation set, plus every conflict found.

def mergeByContent(base: GenericElement, left: GenericElement, right: GenericElement, ignoredAttributes: Set[String] = ...): StructuralMergeResult

merge, but for a document type with no stable per-node identity at all (see ContentMatcher's own doc, and MERGE.md's "silently lose an edit..." finding, from real KML) - left and right are each matched against base by content/structure first, via ContentMatcher, instead of raw position. An edited-but-not-moved node then keeps its base identity across the edit, instead of silently inheriting whichever base identity now happens to sit at its shifted position.

merge, but for a document type with no stable per-node identity at all (see ContentMatcher's own doc, and MERGE.md's "silently lose an edit..." finding, from real KML) - left and right are each matched against base by content/structure first, via ContentMatcher, instead of raw position. An edited-but-not-moved node then keeps its base identity across the edit, instead of silently inheriting whichever base identity now happens to sit at its shifted position.

Value parameters

base

the common ancestor.

ignoredAttributes

forwarded to both PcsEditDetector.detectEdits and ContentMatcher.matchTrees - so a subtree that only differs from base in one of these attributes still counts as an exact content match, not just as a non-conflicting edit once matched.

left

one independently modified version.

right

the other independently modified version.

Attributes

Returns

the resolved relation set, plus every conflict found.