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

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

public class MergeStrategy
extends java.lang.Object

A merge strategy is a vistor/stratey defining some way in which potential merge conflicts can be resolved in the set.

Version:
$Id $

Field Summary
static MergeStrategy OVERWRITE
          Overwrite strategy adds items from the right, and overwrites duplicates.
static MergeStrategy PRESERVE
          Preserve strategy only adds items from the right.
 
Constructor Summary
MergeStrategy()
           
 
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
 

Field Detail

PRESERVE

public static final MergeStrategy PRESERVE
Preserve strategy only adds items from the right.


OVERWRITE

public static final MergeStrategy OVERWRITE
Overwrite strategy adds items from the right, and overwrites duplicates.

Constructor Detail

MergeStrategy

public MergeStrategy()
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.

Parameters:
set - in the calling MergeSet
element - in the item present only in the left set
Returns:
count of merged items

inRight

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

Parameters:
set - in the calling MergeSet
element - in the item present only in the left set
Returns:
count of merged items

inBoth

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

Parameters:
set - in the calling MergeSet
pair - the pair of items
Returns:
count of merged items


Copyright © 2004-2010 Codehaus. All Rights Reserved.