PcsEditDetector

com.phasmidsoftware.xmldoc.merge.PcsEditDetector

Detects structural/content edits between a base tree and one modified version, using Pcs.relations rather than TreeMatcher/EditDetector's Self-based matching plus per-node attribute diff. Lindholm's own formula for this ("A Three-way Merge for XML Documents", section 6): the edit set E = T* - T*0 - whatever relation appears in the modified tree's relation set but not the base's is, by definition, an edit; nothing else needs deciding, since Pcs.relations has already reduced both trees to the same uniform vocabulary of relations.

This is genuinely simpler than EditDetector, precisely because it doesn't try to classify what happened (insert/delete/update/move) - it just reports the raw relations PcsMerger needs to reconcile across left and right. In particular, unlike EditDetector, a plain reorder of already-matched siblings shows up here (as new Pcs relations), which PcsSpec already demonstrates EditDetector misses entirely.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def detectEdits(base: GenericElement, modified: GenericElement, ignoredAttributes: Set[String] = ..., modifiedLabel: NodeRef => String = ...): RelationSet

Detects the relation-level edits that turn base into modified.

Detects the relation-level edits that turn base into modified.

Value parameters

base

the base tree.

ignoredAttributes

attribute names to leave out of content comparisons entirely (e.g. an auto-stamped timestamp a caller knows changes on every export regardless of real edits) - empty by default, so nothing is ignored unless a caller opts in. A node whose only difference from base is one of these attributes is reported as unchanged, not as an edit - same as if that attribute didn't exist at all - though the attribute itself is still carried along unchanged wherever a real edit to that node is reported, so it's never lost from the resulting Content.

modified

one modified version of it.

modifiedLabel

how to label modified's nodes - forwarded to Pcs.relations; base always labels itself the ordinary way (Pcs.label), since it's the reference frame everything else is expressed relative to.

Attributes

Returns

every Pcs/Content relation present in modified but not in base.