org.openstreetmap.osmosis.core.merge.v0_6
Class ChangeMerger

java.lang.Object
  extended by org.openstreetmap.osmosis.core.merge.v0_6.ChangeMerger
All Implemented Interfaces:
java.lang.Runnable, Task, ChangeSource, MultiChangeSink, MultiChangeSinkRunnableChangeSource, RunnableChangeSource

public class ChangeMerger
extends java.lang.Object
implements MultiChangeSinkRunnableChangeSource

Merges two change sources into a single data set. Conflicting elements are resolved by using either the latest timestamp (default) or always selecting the second source.

Author:
Brett Henderson

Constructor Summary
ChangeMerger(ConflictResolutionMethod conflictResolutionMethod, int inputBufferCapacity)
          Creates a new instance.
 
Method Summary
 ChangeSink getChangeSink(int instance)
          Obtains one of the change sinks exposed by the task.
 int getChangeSinkCount()
          This implementation always returns 2.
 void run()
          
 void setChangeSink(ChangeSink changeSink)
          Sets the change sink to send data to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeMerger

public ChangeMerger(ConflictResolutionMethod conflictResolutionMethod,
                    int inputBufferCapacity)
Creates a new instance.

Parameters:
conflictResolutionMethod - The method to used to resolve conflict when two sources contain the same entity.
inputBufferCapacity - The size of the buffers to use for input sources.
Method Detail

getChangeSink

public ChangeSink getChangeSink(int instance)
Obtains one of the change sinks exposed by the task.

Specified by:
getChangeSink in interface MultiChangeSink
Parameters:
instance - The index of the change sink to be returned.
Returns:
The change sink.

getChangeSinkCount

public int getChangeSinkCount()
This implementation always returns 2.

Specified by:
getChangeSinkCount in interface MultiChangeSink
Returns:
2

setChangeSink

public void setChangeSink(ChangeSink changeSink)
Sets the change sink to send data to.

Specified by:
setChangeSink in interface ChangeSource
Parameters:
changeSink - The sink for receiving all produced data.

run

public void run()

Specified by:
run in interface java.lang.Runnable