edu.UCL.xmiddle.lib.treediff
Class LevelTreeMerge

java.lang.Object
  |
  +--edu.UCL.xmiddle.lib.treediff.LevelTreeMerge

public class LevelTreeMerge
extends java.lang.Object

LevelTreeMerge implements an algorithm to apply a diff-tree to a base tree so as to produce a new, modified tree. The diff tree can be created using the LevelTreeDiff class.

See Also:
LevelTreeDiff

Constructor Summary
LevelTreeMerge()
           
 
Method Summary
static org.w3c.dom.Document merge(org.w3c.dom.Document base, org.w3c.dom.Document diff)
          This method applies all changes in a diff tree to a base tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelTreeMerge

public LevelTreeMerge()
Method Detail

merge

public static org.w3c.dom.Document merge(org.w3c.dom.Document base,
                                         org.w3c.dom.Document diff)
This method applies all changes in a diff tree to a base tree. Caution, the base tree is destroyed in the process. If you need to retain the base tree, make a copy of it beforehand.

Parameters:
base - the Document object of the base tree. Make sure you don't pass a null object or any other invalid stuff.
diff - the Document object corresponding to the diff tree, as produced by LevelTreeDiff. The diff tree must be in the format specified in LevelTreeDiff.
Returns:
the new tree with the changes applied