Changeset 2958 in josm for trunk/src/org
- Timestamp:
- 2010-02-09T21:31:20+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r2925 r2958 16 16 public class DatasetConsistencyTest { 17 17 18 private static final int MAX_ERRORS = 100; 18 19 private final DataSet dataSet; 19 20 private final PrintWriter writer; 21 private int errorCount; 20 22 21 23 public DatasetConsistencyTest(DataSet dataSet, Writer writer) { … … 25 27 26 28 private void printError(String type, String message, Object... args) { 27 writer.println("[" + type + "] " + String.format(message, args)); 29 errorCount++; 30 if (errorCount <= MAX_ERRORS) { 31 writer.println("[" + type + "] " + String.format(message, args)); 32 } 28 33 } 29 34 30 p rivatevoid checkReferrers() {35 public void checkReferrers() { 31 36 for (Way way:dataSet.getWays()) { 32 37 if (!way.isDeleted()) { … … 50 55 } 51 56 52 p rivatevoid checkCompleteWaysWithIncompleteNodes() {57 public void checkCompleteWaysWithIncompleteNodes() { 53 58 for (Way way:dataSet.getWays()) { 54 59 if (way.isUsable()) { … … 62 67 } 63 68 64 p rivatevoid checkCompleteNodesWithoutCoordinates() {69 public void checkCompleteNodesWithoutCoordinates() { 65 70 for (Node node:dataSet.getNodes()) { 66 71 if (!node.isIncomplete() && (node.getCoor() == null || node.getEastNorth() == null)) { … … 70 75 } 71 76 72 p rivatevoid searchNodes() {77 public void searchNodes() { 73 78 for (Node n:dataSet.getNodes()) { 74 79 if (!n.isIncomplete() && !n.isDeleted()) { … … 82 87 } 83 88 84 p rivatevoid searchWays() {89 public void searchWays() { 85 90 for (Way w:dataSet.getWays()) { 86 if (!w.isIncomplete() && !w.isDeleted() && !dataSet.searchWays(w.getBBox()).contains(w)) {91 if (!w.isIncomplete() && !w.isDeleted() && w.getNodesCount() >= 2 && !dataSet.searchWays(w.getBBox()).contains(w)) { 87 92 printError("SEARCH WAYS", "%s not found using Dataset.searchWays()", w); 88 93 } … … 102 107 } 103 108 104 p rivatevoid referredPrimitiveNotInDataset() {109 public void referredPrimitiveNotInDataset() { 105 110 for (Way way:dataSet.getWays()) { 106 111 for (Node node:way.getNodes()) { … … 117 122 118 123 119 p rivatevoid checkZeroNodesWays() {124 public void checkZeroNodesWays() { 120 125 for (Way way:dataSet.getWays()) { 121 126 if (way.isUsable() && way.getNodesCount() == 0) { … … 136 141 referredPrimitiveNotInDataset(); 137 142 checkZeroNodesWays(); 143 if (errorCount > MAX_ERRORS) { 144 writer.println((errorCount - MAX_ERRORS) + " more..."); 145 } 138 146 } catch (Exception e) { 139 147 writer.println("Exception during dataset integrity test:");
Note:
See TracChangeset
for help on using the changeset viewer.