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

java.lang.Object
  extended by org.codehaus.cargo.module.merge.strategy.MergeStrategy
      extended by org.codehaus.cargo.module.merge.strategy.AbstractChoiceMergeStrategy
Direct Known Subclasses:
ChooseByNameMergeStrategy

public abstract class AbstractChoiceMergeStrategy
extends MergeStrategy

A merging strategy that can make a decision between various differing merge strategies, depending upon the state that it is passed. Child classes implement the getApplicableStrategy based on whatever information is neccessary to make that decision

Version:
$Id: $

Field Summary
 
Fields inherited from class org.codehaus.cargo.module.merge.strategy.MergeStrategy
OVERWRITE, PRESERVE
 
Constructor Summary
AbstractChoiceMergeStrategy()
           
 
Method Summary
 int inBoth(AbstractMergeSet set, MergePair pair)
          Deal with merging an element appears in both sets.
 int inLeft(AbstractMergeSet set, org.w3c.dom.Element element)
          Deal with merging an element that only appears in the left set.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractChoiceMergeStrategy

public AbstractChoiceMergeStrategy()
Method Detail

inLeft

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

Overrides:
inLeft 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.inLeft(org.codehaus.cargo.module.merge.AbstractMergeSet, org.w3c.dom.Element)

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-2010 Codehaus. All Rights Reserved.