public class SimilarNamedWays extends Test
Modifier and Type | Class and Description |
---|---|
static interface |
SimilarNamedWays.NormalizeRule
A normalization that is applied to names before testing them
|
static class |
SimilarNamedWays.RegExprRule
A rule to replace by regular expression,
so that all strings matching the regular expression are handled as if they were
SimilarNamedWays.RegExprRule.replacement |
static class |
SimilarNamedWays.SynonymRule
A rule that registers synonyms to a given word
|
Test.TagTest
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.awt.geom.Point2D,java.util.List<Way>> |
cellWays
All ways, grouped by cells
|
private MultiMap<Way,Way> |
errorWays
The already detected errors
|
private java.util.List<SimilarNamedWays.NormalizeRule> |
rules |
protected static int |
SIMILAR_NAMED |
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, stopwatch, testBeforeUpload
Constructor and Description |
---|
SimilarNamedWays()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addRegExprRule(java.lang.String regExpr,
java.lang.String replacement)
Add a regular expression rule.
|
void |
addSynonyms(java.lang.String... words)
Add a rule with synonym words.
|
void |
endTest()
Notification of the end of the test.
|
boolean |
similaryName(java.lang.String name,
java.lang.String name2)
Check if two names are similar, but not identical.
|
void |
startTest(ProgressMonitor monitor)
Start the test using a given progress monitor
|
void |
visit(Way w)
Visiting call for lines.
|
addGui, clear, deletePrimitivesIfNeeded, fixError, getErrors, getName, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit, visit
protected static final int SIMILAR_NAMED
private java.util.Map<java.awt.geom.Point2D,java.util.List<Way>> cellWays
private final java.util.List<SimilarNamedWays.NormalizeRule> rules
public SimilarNamedWays()
public void startTest(ProgressMonitor monitor)
Test
public void endTest()
Test
If you override this method, don't forget to cleanup progressMonitor
(most overrides call super.endTest()
to do this).
public void visit(Way w)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
visit
in class Test
w
- The way to inspect.public void addRegExprRule(java.lang.String regExpr, java.lang.String replacement)
regExpr
- the regular expression to search forreplacement
- a string to replace with, which should match the expression.public void addSynonyms(java.lang.String... words)
words
- words which are synonymspublic boolean similaryName(java.lang.String name, java.lang.String name2)
replaceAll("\\d+", "0")
name
- first name to comparename2
- second name to compare