org.openstreetmap.osmosis.core.merge.v0_5
Class EntityMerger

java.lang.Object
  extended by org.openstreetmap.osmosis.core.merge.v0_5.EntityMerger
All Implemented Interfaces:
java.lang.Runnable, Task, MultiSink, MultiSinkRunnableSource, RunnableSource, Source

public class EntityMerger
extends java.lang.Object
implements MultiSinkRunnableSource

Merges two 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
EntityMerger(ConflictResolutionMethod conflictResolutionMethod, int inputBufferCapacity)
          Creates a new instance.
 
Method Summary
 Sink getSink(int instance)
          Obtains one of the sinks exposed by the task.
 int getSinkCount()
          This implementation always returns 2.
 void run()
          
 void setSink(Sink sink)
          Sets the osm 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

EntityMerger

public EntityMerger(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

getSink

public Sink getSink(int instance)
Obtains one of the sinks exposed by the task.

Specified by:
getSink in interface MultiSink
Parameters:
instance - The index of the sink to be returned.
Returns:
The sink.

getSinkCount

public int getSinkCount()
This implementation always returns 2.

Specified by:
getSinkCount in interface MultiSink
Returns:
2

setSink

public void setSink(Sink sink)
Sets the osm sink to send data to.

Specified by:
setSink in interface Source
Parameters:
sink - The sink for receiving all produced data.

run

public void run()

Specified by:
run in interface java.lang.Runnable