Changeset 2291 in josm for trunk/src/org
- Timestamp:
- 2009-10-15T22:20:19+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r2273 r2291 230 230 231 231 switch (mode) { 232 case NONE: 233 return false; 234 case MISSING_KEY: 235 return osm.get(key) == null; 236 case ANY: 237 return true; 238 case ANY_VALUE: 239 return osm.get(key) != null; 240 case ANY_KEY: 241 for (String v:osm.getKeys().values()) { 242 if (v.equals(value)) 243 return true; 244 } 245 return false; 246 case EXACT: 247 return value.equals(osm.get(key)); 248 case ANY_KEY_REGEXP: 249 for (String v:osm.getKeys().values()) { 250 if (valuePattern.matcher(v).matches()) 251 return true; 252 } 253 return false; 254 case ANY_VALUE_REGEXP: 255 case EXACT_REGEXP: 256 for (Entry<String, String> entry:osm.entrySet()) { 257 if (keyPattern.matcher(entry.getKey()).matches()) { 258 if (mode == Mode.ANY_VALUE_REGEXP 259 || valuePattern.matcher(entry.getValue()).matches()) 232 case NONE: 233 return false; 234 case MISSING_KEY: 235 return osm.get(key) == null; 236 case ANY: 237 return true; 238 case ANY_VALUE: 239 return osm.get(key) != null; 240 case ANY_KEY: 241 for (String v:osm.getKeys().values()) { 242 if (v.equals(value)) 260 243 return true; 261 244 } 262 } 263 return false; 264 case MISSING_KEY_REGEXP: 265 for (String k:osm.keySet()) { 266 if (keyPattern.matcher(k).matches()) 267 return false; 268 } 269 return true; 245 return false; 246 case EXACT: 247 return value.equals(osm.get(key)); 248 case ANY_KEY_REGEXP: 249 for (String v:osm.getKeys().values()) { 250 if (valuePattern.matcher(v).matches()) 251 return true; 252 } 253 return false; 254 case ANY_VALUE_REGEXP: 255 case EXACT_REGEXP: 256 for (Entry<String, String> entry:osm.entrySet()) { 257 if (keyPattern.matcher(entry.getKey()).matches()) { 258 if (mode == Mode.ANY_VALUE_REGEXP 259 || valuePattern.matcher(entry.getValue()).matches()) 260 return true; 261 } 262 } 263 return false; 264 case MISSING_KEY_REGEXP: 265 for (String k:osm.keySet()) { 266 if (keyPattern.matcher(k).matches()) 267 return false; 268 } 269 return true; 270 270 } 271 271 throw new AssertionError("Missed state"); … … 331 331 } 332 332 } 333 if (osm. user!= null) {334 String name = osm. user.getName();333 if (osm.getUser() != null) { 334 String name = osm.getUser().getName(); 335 335 // is not Java 1.5 336 336 //String name = java.text.Normalizer.normalize(name, java.text.Normalizer.Form.NFC); … … 377 377 } 378 378 @Override public boolean match(OsmPrimitive osm) { 379 if (osm. user== null && user == null) return true;380 if (osm. user== null) return false;381 return osm. user.equals(user);379 if (osm.getUser() == null && user == null) return true; 380 if (osm.getUser() == null) return false; 381 return osm.getUser().equals(user); 382 382 } 383 383 @Override public String toString() { -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2284 r2291 135 135 * Never changed by JOSM. 136 136 */ 137 p ublicUser user = null;137 private User user = null; 138 138 139 139 /** … … 161 161 this.id = id; 162 162 } else { 163 if (id < 0) {163 if (id < 0) 164 164 throw new IllegalArgumentException(tr("Expected ID >= 0. Got {0}.", id)); 165 }else if (id == 0) {165 else if (id == 0) { 166 166 this.id = idCounter.decrementAndGet(); 167 167 } else { … … 483 483 setModified(deleted); 484 484 setSelected(false); 485 } 486 487 /** 488 * Replies the user who has last touched this object. May be null. 489 * 490 * @return the user who has last touched this object. May be null. 491 */ 492 public User getUser() { 493 return user; 494 } 495 496 /** 497 * Sets the user who has last touched this object. 498 * 499 * @param user the user 500 */ 501 public void setUser(User user) { 502 this.user = user; 485 503 } 486 504 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r2273 r2291 121 121 // version 122 122 my.setVisible(other.isVisible()); 123 my. user = other.user;123 my.setUser(other.getUser()); 124 124 my.setTimestamp(other.getTimestamp()); 125 125 my.setModified(other.isModified()); -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r2273 r2291 425 425 } 426 426 427 if(osm. user!= null) {428 text.append(" [" + tr("User:") + " " + osm. user.getName() + "]");427 if(osm.getUser() != null) { 428 text.append(" [" + tr("User:") + " " + osm.getUser().getName() + "]"); 429 429 } 430 430 -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r2073 r2291 278 278 if (primitives == null || primitives.isEmpty()) return ret; 279 279 for (OsmPrimitive primitive: primitives) { 280 if (primitive. user== null) {280 if (primitive.getUser() == null) { 281 281 continue; 282 282 } 283 if (ret.containsKey(primitive. user)) {284 ret.put(primitive. user, ret.get(primitive.user) + 1);283 if (ret.containsKey(primitive.getUser())) { 284 ret.put(primitive.getUser(), ret.get(primitive.getUser()) + 1); 285 285 } else { 286 ret.put(primitive. user, 1);286 ret.put(primitive.getUser(), 1); 287 287 } 288 288 } … … 335 335 Collection<OsmPrimitive> byUser = new LinkedList<OsmPrimitive>(); 336 336 for (OsmPrimitive p : selected) { 337 if (p. user== null) {337 if (p.getUser() == null) { 338 338 continue; 339 339 } 340 if (users.contains(p. user)) {340 if (users.contains(p.getUser())) { 341 341 byUser.add(p); 342 342 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2266 r2291 101 101 osm.setModified(modified | deleted); 102 102 osm.setTimestamp(timestamp); 103 osm. user = user;103 osm.setUser(user); 104 104 osm.setVisible(visible); 105 105 osm.mappaintStyle = null; -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r2273 r2291 225 225 } 226 226 // user and visible added with 0.4 API 227 if (osm. user!= null) {228 if(osm. user.isLocalUser()) {229 out.print(" user='"+XmlWriter.encode(osm. user.getName())+"'");230 } else if (osm. user.isOsmUser()) {227 if (osm.getUser() != null) { 228 if(osm.getUser().isLocalUser()) { 229 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'"); 230 } else if (osm.getUser().isOsmUser()) { 231 231 // uid added with 0.6 232 out.print(" uid='"+ osm. user.getId()+"'");233 out.print(" user='"+XmlWriter.encode(osm. user.getName())+"'");232 out.print(" uid='"+ osm.getUser().getId()+"'"); 233 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'"); 234 234 } 235 235 }
Note:
See TracChangeset
for help on using the changeset viewer.