OpenOffice.org
XMerge API

org.openoffice.xmerge.merger.merge
Class DocumentMerge

java.lang.Object
  |
  +--org.openoffice.xmerge.merger.merge.DocumentMerge
All Implemented Interfaces:
MergeAlgorithm
Direct Known Subclasses:
SheetMerge

public class DocumentMerge
extends java.lang.Object
implements MergeAlgorithm

This is an implementation of the MergeAlgorithm interface. This class will merge two Document classes. It utilizes the appropriate class which implements NodeMergeAlgorithm to perform the merge.


Field Summary
protected  ConverterCapabilities cc_
          The capabilities of this converter.
 
Constructor Summary
DocumentMerge(ConverterCapabilities cc, NodeMergeAlgorithm merge)
          Constructor
 
Method Summary
protected  void appendNode(org.w3c.dom.Node oldNode, org.w3c.dom.Node newNode)
          Appends Node after the specified Node.
 void applyDifference(Iterator orgSeq, Iterator modSeq, Difference[] differences)
          This method is to merge the difference to an Iterator.
protected  void insertNode(org.w3c.dom.Node oldNode, org.w3c.dom.Node newNode)
          Insert Node before the specified Node.
protected  void removeNode(org.w3c.dom.Node node)
          Removes the specified Node.
protected  void replaceElement(org.w3c.dom.Element currElem, org.w3c.dom.Element newElem)
          Replace Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cc_

protected ConverterCapabilities cc_
The capabilities of this converter.
Constructor Detail

DocumentMerge

public DocumentMerge(ConverterCapabilities cc,
                     NodeMergeAlgorithm merge)
Constructor
Parameters:
cc - The ConverterCapabilities.
merge - The NodeMergeAlgorithm.
Method Detail

appendNode

protected void appendNode(org.w3c.dom.Node oldNode,
                          org.w3c.dom.Node newNode)
Appends Node after the specified Node.
Parameters:
oldNode - Node to append after.
newNode - Node to append.

applyDifference

public void applyDifference(Iterator orgSeq,
                            Iterator modSeq,
                            Difference[] differences)
                     throws MergeException
Description copied from interface: MergeAlgorithm
This method is to merge the difference to an Iterator. The original Iterator will be modified after the call.
Specified by:
applyDifference in interface MergeAlgorithm
Following copied from interface: org.openoffice.xmerge.merger.MergeAlgorithm
Parameters:
objSeq - The original sequence which the difference will be applied. It will be modified.
modSeq - The modified sequence where the difference content will be extracted.
differences - The Difference array.
Returns:
An Iterator which is the modified original Iterator Sequence. Same as the first parameter.
Throws:
MergeException - If an error occurs during the merge.

insertNode

protected void insertNode(org.w3c.dom.Node oldNode,
                          org.w3c.dom.Node newNode)
Insert Node before the specified Node.
Parameters:
oldNode - Node to insert before.
newNode - Node to insert.

removeNode

protected void removeNode(org.w3c.dom.Node node)
Removes the specified Node.
Parameters:
node - Node to remove.

replaceElement

protected void replaceElement(org.w3c.dom.Element currElem,
                              org.w3c.dom.Element newElem)
Replace Element.
Parameters:
currElem - Element to be replaced.
newElem - Element to replace.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org