org.codehaus.cargo.module.merge.strategy
Class NodeMergeStrategy

java.lang.Object
  extended by org.codehaus.cargo.module.merge.strategy.MergeStrategy
      extended by org.codehaus.cargo.module.merge.strategy.NodeMergeStrategy

public class NodeMergeStrategy
extends MergeStrategy

A merging strategy that can be used to combine two XML documents together.

Version:
$Id $

Field Summary
 
Fields inherited from class org.codehaus.cargo.module.merge.strategy.MergeStrategy
OVERWRITE, PRESERVE
 
Constructor Summary
NodeMergeStrategy(org.w3c.dom.Element template)
          Constructor.
NodeMergeStrategy(java.io.InputStream template)
          Constructor.
 
Method Summary
 int inBoth(AbstractMergeSet set, MergePair pair)
          Deal with merging an element appears in both sets.
 int inRight(AbstractMergeSet set, org.w3c.dom.Element element)
          Deal with merging an element that only appears in the right set.
 
Methods inherited from class org.codehaus.cargo.module.merge.strategy.MergeStrategy
inLeft
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeMergeStrategy

public NodeMergeStrategy(org.w3c.dom.Element template)
Constructor.

Parameters:
template - in the template to use in the merge

NodeMergeStrategy

public NodeMergeStrategy(java.io.InputStream template)
                  throws org.xml.sax.SAXException,
                         java.io.IOException,
                         javax.xml.parsers.ParserConfigurationException
Constructor.

Parameters:
template - in the template to use in the merge (XML)
Throws:
javax.xml.parsers.ParserConfigurationException - if parser error
java.io.IOException - if IO Exception
org.xml.sax.SAXException - if SAX Exception
Method Detail

inRight

public int inRight(AbstractMergeSet set,
                   org.w3c.dom.Element element)
Deal with merging an element that only appears in the right set.

Overrides:
inRight in class MergeStrategy
Parameters:
set - in the calling MergeSet
element - in the item present only in the left set
Returns:
count of merged items
See Also:
MergeStrategy.inRight(org.codehaus.cargo.module.merge.AbstractMergeSet, org.w3c.dom.Element)

inBoth

public int inBoth(AbstractMergeSet set,
                  MergePair pair)
Deal with merging an element appears in both sets.

Overrides:
inBoth in class MergeStrategy
Parameters:
set - in the calling MergeSet
pair - the pair of items
Returns:
count of merged items
See Also:
MergeStrategy.inBoth(org.codehaus.cargo.module.merge.AbstractMergeSet, org.codehaus.cargo.module.merge.MergePair)


Copyright © 2004-2009 Codehaus. All Rights Reserved.