org.openstreetmap.osmosis.core.filter.v0_6
Class TagFilter

java.lang.Object
  extended by org.openstreetmap.osmosis.core.filter.v0_6.TagFilter
All Implemented Interfaces:
Completable, Releasable, Task, Sink, SinkSource, Source

public class TagFilter
extends java.lang.Object
implements SinkSource

A simple class to filter node, way, and relation entities by their tag keys and/or values.

Author:
Andrew Byrd

Constructor Summary
TagFilter(java.lang.String filterMode, java.util.Set<java.lang.String> tagKeys, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tagKeyValues)
          Creates a new instance.
 
Method Summary
 void complete()
          Ensures that all information is fully persisted.
 void process(EntityContainer container)
          Process the entity.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 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

TagFilter

public TagFilter(java.lang.String filterMode,
                 java.util.Set<java.lang.String> tagKeys,
                 java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tagKeyValues)
Creates a new instance.

Parameters:
filterMode - A 2-field dash-separated string specifying: 1. Whether the filter accepts or rejects entities 2. The entity type upon which it operates
tagKeys - A Set of tag key Strings. The filter will match these tags irrespective of tag values.
tagKeyValues - A map of tag key Strings to Sets of tag key values. These key-value pairs are checked against each entity's tags to determine whether or not it matches the filter.
Method Detail

process

public void process(EntityContainer container)
Process the entity.

Specified by:
process in interface Sink
Parameters:
container - The entity to be processed.

complete

public void complete()
Ensures that all information is fully persisted. This includes database commits, file buffer flushes, etc. Implementations must call complete on any nested Completable objects. Where the releasable method of a Releasable class should be called within a finally block, this method should typically be the final statement within the try block.

Specified by:
complete in interface Completable

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable

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.