de.gruschke.dasync
Class MapComparer

java.lang.Object
  |
  +--de.gruschke.dasync.MapComparer
Direct Known Subclasses:
PrintDiffMapComparer, UpdateDSMapComparer

public abstract class MapComparer
extends java.lang.Object

Functionality common to all sorts of synchronization jobs.

Author:
Boris Gruschke

Field Summary
protected  boolean verbose
           
 
Constructor Summary
MapComparer()
           
 
Method Summary
 void compare(java.util.Map one, java.util.Map two)
          Computes comparison of two maps Compare invokes the methods inOneOnly(...), inTwoOnly(...) if a key appears in one of the maps only, oneAndTwoDiffer(...) if a key appears in both maps but with different values and oneAndTwoEqual(...) if a key appears in both maps and both values are equal.
protected abstract  void inOneOnly(java.lang.Object key, java.lang.Object value)
          Key appears in Map one only
protected abstract  void inTwoOnly(java.lang.Object key, java.lang.Object value)
          Key appears in Map two only
protected abstract  void oneAndTwoDiffer(java.lang.Object key, java.lang.Object valueOne, java.lang.Object valueTwo)
          Key appears in both Maps but with different values
protected abstract  void oneAndTwoEqual(java.lang.Object key, java.lang.Object value)
          Key appears in both Maps with equal values
 void setVerbose()
          screw up the debugging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verbose

protected boolean verbose
Constructor Detail

MapComparer

public MapComparer()
Method Detail

compare

public void compare(java.util.Map one,
                    java.util.Map two)
Computes comparison of two maps Compare invokes the methods inOneOnly(...), inTwoOnly(...) if a key appears in one of the maps only, oneAndTwoDiffer(...) if a key appears in both maps but with different values and oneAndTwoEqual(...) if a key appears in both maps and both values are equal.
Parameters:
one - Map of Keys and DataRow objects
two - Map of Keys and DataRow objects

setVerbose

public void setVerbose()
screw up the debugging

inOneOnly

protected abstract void inOneOnly(java.lang.Object key,
                                  java.lang.Object value)
Key appears in Map one only
Parameters:
key - key object from Map one
value - DataRow object from Map one

inTwoOnly

protected abstract void inTwoOnly(java.lang.Object key,
                                  java.lang.Object value)
Key appears in Map two only
Parameters:
key - key object from Map two
value - DataRow object from Map two

oneAndTwoDiffer

protected abstract void oneAndTwoDiffer(java.lang.Object key,
                                        java.lang.Object valueOne,
                                        java.lang.Object valueTwo)
Key appears in both Maps but with different values
Parameters:
key - key object from one of the Maps
valueOne - DataRow object from Map one
valueTwo - DataRow object from Map two

oneAndTwoEqual

protected abstract void oneAndTwoEqual(java.lang.Object key,
                                       java.lang.Object value)
Key appears in both Maps with equal values
Parameters:
key - key object from one of the Maps
value - DataRow object from one of the Maps


Boris Gruschke, 2000-11-11
License: GPL