Class xcc.Diff

Create a new instance of the XCC diff implementation.

Constructor

class xcc.Diff(a, b, options)
Arguments:
  • a (tree.Node) – Root node of original tree
  • b (tree.Node) – Root node of changed tree
  • options (Object) – Options

Methods

Diff#equals

xcc.Diff.Diff#equals(a, b)
Arguments:
  • a (tree.Node) – Candidate node from tree a
  • b (tree.Node) – Candidate node from tree b
Returns boolean:
 

Return true if the value of the two nodes is equal.

Default equality test. Override this method if you need to test other node properties instead/beside node value.

Diff#matchLeafLCS

xcc.Diff.Diff#matchLeafLCS(matching)
Arguments:
  • matching (tree.Matching) – A tree matching which will be populated by diffing tree a and b.

Identify unchanged leaves by comparing them using myers longest common subsequence algorithm.

Diff#matchLeafUpdates

xcc.Diff.Diff#matchLeafUpdates(matching)
Arguments:
  • matching (tree.Matching) – A tree matching which will be populated by diffing tree a and b.

Detect updated leaf nodes by analyzing their neighborhood top-down.

Diff#matchLeafUpdatesOnDescendants

xcc.Diff.Diff#matchLeafUpdatesOnDescendants(matching, a_node[, reject])
Arguments:
  • matching (tree.Matching) – A tree matching which will be populated by diffing tree a and b.
  • a_node (tree.Node) – A node from tree a which already takes part in the matching.
  • reject (function) – A user supplied function which may indicate a given node should not be considered when detecting node updates. The function should take one argument (tree.Node) and return true (reject) or false (do not reject).

Identify leaf-node updates by traversing descendants of b_node top-down. b_node must already be part of the matching.

Diff#matchTrees

xcc.Diff.Diff#matchTrees(matching)
Arguments:
  • matching (tree.Matching) – A tree matching which will be populated by diffing tree a and b.

Create a matching between the two nodes using the xcc diff algorithm

Table Of Contents

Previous topic

XCC Diff Algorithm

Next topic

Skel-Match Diff Algorithm