Changeset 11129 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java
- Timestamp:
- 2016-10-15T00:17:47+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java
r9244 r11129 5 5 6 6 import java.util.ArrayList; 7 import java.util.Arrays;8 import java.util.Collections;9 7 import java.util.List; 10 8 … … 99 97 break; 100 98 default: 101 errors.add(new TestError(this, Severity.WARNING, tr("Unknown role"), UNKNOWN_ROLE, 102 l, Collections.singletonList(m))); 99 errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_ROLE) 100 .message(tr("Unknown role")) 101 .primitives(l) 102 .highlight(m.getMember()) 103 .build()); 103 104 } 104 105 } else if (m.isNode()) { … … 115 116 } 116 117 } else { 117 errors.add(new TestError(this, Severity.WARNING, tr("Unknown role"), UNKNOWN_ROLE, 118 l, Collections.singletonList(m))); 118 errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_ROLE) 119 .message(tr("Unknown role")) 120 .primitives(l) 121 .highlight(m.getMember()) 122 .build()); 119 123 } 120 124 } else { 121 errors.add(new TestError(this, Severity.WARNING, tr("Unknown member type"), UNKNOWN_TYPE, 122 l, Collections.singletonList(m))); 125 errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_TYPE) 126 .message(tr("Unknown member type")) 127 .primitives(l) 128 .highlight(m.getMember()) 129 .build()); 123 130 } 124 131 } 125 132 if (morefrom) { 126 errors.add(new TestError(this, Severity.ERROR, tr("More than one \"from\" way found"), MORE_FROM, r)); 133 errors.add(TestError.builder(this, Severity.ERROR, MORE_FROM) 134 .message(tr("More than one \"from\" way found")) 135 .primitives(r) 136 .build()); 127 137 } 128 138 if (moreto) { 129 errors.add(new TestError(this, Severity.ERROR, tr("More than one \"to\" way found"), MORE_TO, r)); 139 errors.add(TestError.builder(this, Severity.ERROR, MORE_TO) 140 .message(tr("More than one \"to\" way found")) 141 .primitives(r) 142 .build()); 130 143 } 131 144 if (morevia) { 132 errors.add(new TestError(this, Severity.ERROR, tr("More than one \"via\" node found"), MORE_VIA, r)); 145 errors.add(TestError.builder(this, Severity.ERROR, MORE_VIA) 146 .message(tr("More than one \"via\" node found")) 147 .primitives(r) 148 .build()); 133 149 } 134 150 if (mixvia) { 135 errors.add(new TestError(this, Severity.ERROR, tr("Cannot mix node and way for role \"via\""), MIX_VIA, r)); 151 errors.add(TestError.builder(this, Severity.ERROR, MIX_VIA) 152 .message(tr("Cannot mix node and way for role \"via\"")) 153 .primitives(r) 154 .build()); 136 155 } 137 156 138 157 if (fromWay == null) { 139 errors.add(new TestError(this, Severity.ERROR, tr("No \"from\" way found"), NO_FROM, r)); 158 errors.add(TestError.builder(this, Severity.ERROR, NO_FROM) 159 .message(tr("No \"from\" way found")) 160 .primitives(r) 161 .build()); 140 162 return; 141 163 } 142 164 if (toWay == null) { 143 errors.add(new TestError(this, Severity.ERROR, tr("No \"to\" way found"), NO_TO, r)); 165 errors.add(TestError.builder(this, Severity.ERROR, NO_TO) 166 .message(tr("No \"to\" way found")) 167 .primitives(r) 168 .build()); 144 169 return; 145 170 } 146 171 if (fromWay.equals(toWay)) { 147 errors.add(new TestError(this, r.hasTag("restriction", "no_u_turn") ? Severity.OTHER : Severity.WARNING, 148 tr("\"from\" way equals \"to\" way"), FROM_EQUALS_TO, r)); 172 Severity severity = r.hasTag("restriction", "no_u_turn") ? Severity.OTHER : Severity.WARNING; 173 errors.add(TestError.builder(this, severity, FROM_EQUALS_TO) 174 .message(tr("\"from\" way equals \"to\" way")) 175 .primitives(r) 176 .build()); 149 177 } 150 178 if (via.isEmpty()) { 151 errors.add(new TestError(this, Severity.ERROR, tr("No \"via\" node or way found"), NO_VIA, r)); 179 errors.add(TestError.builder(this, Severity.ERROR, NO_VIA) 180 .message(tr("No \"via\" node or way found")) 181 .primitives(r) 182 .build()); 152 183 return; 153 184 } … … 160 191 tr("The \"from\" way does not start or end at a \"via\" node."), FROM_VIA_NODE); 161 192 if (toWay.isOneway() != 0 && viaNode.equals(toWay.lastNode(true))) { 162 errors.add(new TestError(this, Severity.WARNING, tr("Superfluous turnrestriction as \"to\" way is oneway"), SUPERFLUOUS, r)); 193 errors.add(TestError.builder(this, Severity.WARNING, SUPERFLUOUS) 194 .message(tr("Superfluous turnrestriction as \"to\" way is oneway")) 195 .primitives(r) 196 .build()); 163 197 return; 164 198 } … … 178 212 } 179 213 if (toWay.isOneway() != 0 && ((Way) via.get(via.size() - 1)).isFirstLastNode(toWay.lastNode(true))) { 180 errors.add(new TestError(this, Severity.WARNING, tr("Superfluous turnrestriction as \"to\" way is oneway"), SUPERFLUOUS, r)); 214 errors.add(TestError.builder(this, Severity.WARNING, SUPERFLUOUS) 215 .message(tr("Superfluous turnrestriction as \"to\" way is oneway")) 216 .primitives(r) 217 .build()); 181 218 return; 182 219 } … … 206 243 } 207 244 if (!c) { 208 errors.add(new TestError(this, Severity.ERROR, msg, code, Arrays.asList(previous, current))); 245 errors.add(TestError.builder(this, Severity.ERROR, code) 246 .message(msg) 247 .primitives(previous, current) 248 .build()); 209 249 } 210 250 }
Note:
See TracChangeset
for help on using the changeset viewer.