org.openstreetmap.josm.data.validation.tests
Class SimilarNamedWays

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.visitor.AbstractVisitor
      extended by org.openstreetmap.josm.data.validation.Test
          extended by org.openstreetmap.josm.data.validation.tests.SimilarNamedWays
All Implemented Interfaces:
Visitor

public class SimilarNamedWays
extends Test

Checks for similar named ways, symptom of a possible typo. It uses the Levenshtein distance to check for similarity


Field Summary
(package private)  java.util.Map<java.awt.geom.Point2D,java.util.List<Way>> cellWays
          All ways, grouped by cells
(package private)  MultiMap<Way,Way> errorWays
          The already detected errors
protected static int SIMILAR_NAMED
           
 
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, isBeforeUpload, name, partialSelection, progressMonitor, testBeforeUpload
 
Constructor Summary
SimilarNamedWays()
          Constructor
 
Method Summary
 void endTest()
          Notification of the end of the test.
 int getLevenshteinDistance(java.lang.String s, java.lang.String t)
          Compute Levenshtein distance
 void startTest(ProgressMonitor monitor)
          Start the test using a given progress monitor
 void visit(Way w)
          Visiting call for lines.
 
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, deletePrimitivesIfNeeded, fixError, getErrors, getName, initialize, isBuilding, isCanceled, isFixable, ok, setBeforeUpload, setPartialSelection, testBeforeUpload, visit, visit, visit
 
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.AbstractVisitor
visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMILAR_NAMED

protected static final int SIMILAR_NAMED
See Also:
Constant Field Values

cellWays

java.util.Map<java.awt.geom.Point2D,java.util.List<Way>> cellWays
All ways, grouped by cells


errorWays

MultiMap<Way,Way> errorWays
The already detected errors

Constructor Detail

SimilarNamedWays

public SimilarNamedWays()
Constructor

Method Detail

startTest

public void startTest(ProgressMonitor monitor)
Description copied from class: Test
Start the test using a given progress monitor

Overrides:
startTest in class Test
Parameters:
monitor - the progress monitor

endTest

public void endTest()
Description copied from class: Test
Notification of the end of the test. The tester may perform additional actions and destroy the used structures.

If you override this method, don't forget to cleanup Test.progressMonitor (most overrides call super.endTest() to do this).

Overrides:
endTest in class Test

visit

public void visit(Way w)
Description copied from interface: Visitor
Visiting call for lines.

Specified by:
visit in interface Visitor
Overrides:
visit in class Test
Parameters:
w - The way to inspect.

getLevenshteinDistance

public int getLevenshteinDistance(java.lang.String s,
                                  java.lang.String t)
Compute Levenshtein distance

Parameters:
s - First word
t - Second word
Returns:
The distance between words


JOSM