Subject: [PATCH] 4142
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java b/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.openstreetmap.josm.tools.I18n.tr; |
| 5 | 5 | |
| | 6 | import java.io.IOException; |
| | 7 | import java.io.ObjectInputStream; |
| | 8 | import java.io.ObjectOutputStream; |
| 6 | 9 | import java.text.MessageFormat; |
| 7 | 10 | import java.time.Instant; |
| 8 | 11 | import java.util.ArrayList; |
| … |
… |
|
| 130 | 133 | */ |
| 131 | 134 | protected static final short FLAG_PRESERVED = 1 << 13; |
| 132 | 135 | |
| | 136 | /** |
| | 137 | * Determines if the primitive has all of its referrers |
| | 138 | */ |
| | 139 | protected static final short FLAG_ALL_REFERRERS_DOWNLOADED = 1 << 14; |
| | 140 | |
| 133 | 141 | /** |
| 134 | 142 | * Put several boolean flags to one short int field to save memory. |
| 135 | 143 | * Other bits of this field are used in subclasses. |
| 136 | 144 | */ |
| 137 | | protected volatile short flags = FLAG_VISIBLE; // visible per default |
| | 145 | private volatile short flags = FLAG_VISIBLE; // visible per default |
| 138 | 146 | |
| 139 | 147 | /** |
| 140 | 148 | * The mappaint cache index for this primitive. |
| … |
… |
|
| 365 | 373 | return oldFlags != flags; |
| 366 | 374 | } |
| 367 | 375 | |
| | 376 | protected void writeObjectCommon(ObjectOutputStream oos) throws IOException { |
| | 377 | oos.writeLong(id); |
| | 378 | oos.writeLong(user == null ? -1 : user.getId()); |
| | 379 | oos.writeInt(version); |
| | 380 | oos.writeInt(changesetId); |
| | 381 | oos.writeInt(timestamp); |
| | 382 | oos.writeObject(keys); |
| | 383 | oos.writeShort(flags); |
| | 384 | } |
| | 385 | |
| | 386 | protected void readObjectCommon(ObjectInputStream ois) throws ClassNotFoundException, IOException { |
| | 387 | id = ois.readLong(); |
| | 388 | final long userId = ois.readLong(); |
| | 389 | user = userId == -1 ? null : User.getById(userId); |
| | 390 | version = ois.readInt(); |
| | 391 | changesetId = ois.readInt(); |
| | 392 | timestamp = ois.readInt(); |
| | 393 | keys = (String[]) ois.readObject(); |
| | 394 | flags = ois.readShort(); |
| | 395 | } |
| | 396 | |
| 368 | 397 | @Override |
| 369 | 398 | public void setModified(boolean modified) { |
| 370 | 399 | updateFlags(FLAG_MODIFIED, modified); |
| … |
… |
|
| 408 | 437 | setModified(deleted ^ !isVisible()); |
| 409 | 438 | } |
| 410 | 439 | |
| | 440 | @Override |
| | 441 | public boolean hasDirectionKeys() { |
| | 442 | return (flags & FLAG_HAS_DIRECTIONS) != 0; |
| | 443 | } |
| | 444 | |
| | 445 | @Override |
| | 446 | public boolean reversedDirection() { |
| | 447 | return (flags & FLAG_DIRECTION_REVERSED) != 0; |
| | 448 | } |
| | 449 | |
| | 450 | @Override |
| | 451 | public boolean isTagged() { |
| | 452 | return (flags & FLAG_TAGGED) != 0; |
| | 453 | } |
| | 454 | |
| | 455 | @Override |
| | 456 | public boolean isAnnotated() { |
| | 457 | return (flags & FLAG_ANNOTATED) != 0; |
| | 458 | } |
| | 459 | |
| | 460 | @Override |
| | 461 | public boolean isHighlighted() { |
| | 462 | return (flags & FLAG_HIGHLIGHTED) != 0; |
| | 463 | } |
| | 464 | |
| | 465 | @Override |
| | 466 | public boolean isDisabled() { |
| | 467 | return (flags & FLAG_DISABLED) != 0; |
| | 468 | } |
| | 469 | |
| | 470 | @Override |
| | 471 | public boolean isDisabledAndHidden() { |
| | 472 | return ((flags & FLAG_DISABLED) != 0) && ((flags & FLAG_HIDE_IF_DISABLED) != 0); |
| | 473 | } |
| | 474 | |
| | 475 | @Override |
| | 476 | public boolean isPreserved() { |
| | 477 | return (flags & FLAG_PRESERVED) != 0; |
| | 478 | } |
| | 479 | |
| 411 | 480 | /** |
| 412 | 481 | * If set to true, this object is incomplete, which means only the id |
| 413 | 482 | * and type is known (type is the objects instance class) |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/osm/IPrimitive.java b/src/org/openstreetmap/josm/data/osm/IPrimitive.java
|
a
|
b
|
|
| 36 | 36 | */ |
| 37 | 37 | void setModified(boolean modified); |
| 38 | 38 | |
| | 39 | default void setReferrersDownloaded(boolean referrersDownloaded) { |
| | 40 | |
| | 41 | } |
| | 42 | |
| 39 | 43 | /** |
| 40 | 44 | * Checks if object is known to the server. |
| 41 | 45 | * Replies true if this primitive is either unknown to the server (i.e. its id |
| … |
… |
|
| 75 | 79 | */ |
| 76 | 80 | void setDeleted(boolean deleted); |
| 77 | 81 | |
| | 82 | /** |
| | 83 | * Determines if this primitive is fully downloaded |
| | 84 | * @return {@code true} if the primitive is fully downloaded and all parents and children should be available. |
| | 85 | * {@code false} otherwise. |
| | 86 | * @since xxx |
| | 87 | */ |
| | 88 | default boolean isReferrersDownloaded() { |
| | 89 | return false; |
| | 90 | } |
| | 91 | |
| 78 | 92 | /** |
| 79 | 93 | * Determines if this primitive is incomplete. |
| 80 | 94 | * @return {@code true} if this primitive is incomplete, {@code false} otherwise |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java b/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
|
a
|
b
|
|
| 363 | 363 | updateFlags(FLAG_PRESERVED, isPreserved); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | | @Override |
| 367 | | public boolean isDisabled() { |
| 368 | | return (flags & FLAG_DISABLED) != 0; |
| 369 | | } |
| 370 | | |
| 371 | | @Override |
| 372 | | public boolean isDisabledAndHidden() { |
| 373 | | return ((flags & FLAG_DISABLED) != 0) && ((flags & FLAG_HIDE_IF_DISABLED) != 0); |
| 374 | | } |
| 375 | | |
| 376 | | @Override |
| 377 | | public boolean isPreserved() { |
| 378 | | return (flags & FLAG_PRESERVED) != 0; |
| 379 | | } |
| 380 | 366 | |
| 381 | 367 | @Override |
| 382 | 368 | public boolean isSelectable() { |
| … |
… |
|
| 492 | 478 | } |
| 493 | 479 | } |
| 494 | 480 | |
| 495 | | @Override |
| 496 | | public boolean isHighlighted() { |
| 497 | | return (flags & FLAG_HIGHLIGHTED) != 0; |
| 498 | | } |
| 499 | | |
| 500 | 481 | /*--------------- |
| 501 | 482 | * DIRECTION KEYS |
| 502 | 483 | *---------------*/ |
| … |
… |
|
| 526 | 507 | updateFlagsNoLock(FLAG_ANNOTATED, hasKeys() && getWorkInProgressKeys().stream().anyMatch(this::hasKey)); |
| 527 | 508 | } |
| 528 | 509 | |
| 529 | | @Override |
| 530 | | public boolean isTagged() { |
| 531 | | return (flags & FLAG_TAGGED) != 0; |
| 532 | | } |
| 533 | | |
| 534 | | @Override |
| 535 | | public boolean isAnnotated() { |
| 536 | | return (flags & FLAG_ANNOTATED) != 0; |
| 537 | | } |
| 538 | | |
| 539 | 510 | protected void updateDirectionFlags() { |
| 540 | 511 | boolean hasDirections = false; |
| 541 | 512 | boolean directionReversed = false; |
| … |
… |
|
| 551 | 522 | updateFlagsNoLock(FLAG_HAS_DIRECTIONS, hasDirections); |
| 552 | 523 | } |
| 553 | 524 | |
| 554 | | @Override |
| 555 | | public boolean hasDirectionKeys() { |
| 556 | | return (flags & FLAG_HAS_DIRECTIONS) != 0; |
| 557 | | } |
| 558 | | |
| 559 | | @Override |
| 560 | | public boolean reversedDirection() { |
| 561 | | return (flags & FLAG_DIRECTION_REVERSED) != 0; |
| 562 | | } |
| 563 | | |
| 564 | 525 | /*------------ |
| 565 | 526 | * Keys handling |
| 566 | 527 | ------------*/ |
| … |
… |
|
| 851 | 812 | throw new DataIntegrityProblemException( |
| 852 | 813 | tr("Cannot merge primitives with different ids. This id is {0}, the other is {1}", id, other.getId())); |
| 853 | 814 | |
| | 815 | setIncomplete(other.isIncomplete()); |
| | 816 | super.cloneFrom(other); |
| 854 | 817 | setKeys(other.hasKeys() ? other.getKeys() : null); |
| 855 | | timestamp = other.timestamp; |
| 856 | 818 | version = other.version; |
| 857 | | setIncomplete(other.isIncomplete()); |
| 858 | | flags = other.flags; |
| 859 | | user = other.user; |
| 860 | 819 | changesetId = other.changesetId; |
| 861 | 820 | } finally { |
| 862 | 821 | writeUnlock(locked); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/osm/PrimitiveData.java b/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
|
a
|
b
|
|
| 84 | 84 | |
| 85 | 85 | private void writeObject(ObjectOutputStream oos) throws IOException { |
| 86 | 86 | // since super class is not Serializable |
| 87 | | oos.writeLong(id); |
| 88 | | oos.writeLong(user == null ? -1 : user.getId()); |
| 89 | | oos.writeInt(version); |
| 90 | | oos.writeInt(changesetId); |
| 91 | | oos.writeInt(timestamp); |
| 92 | | oos.writeObject(keys); |
| 93 | | oos.writeShort(flags); |
| | 87 | super.writeObjectCommon(oos); |
| 94 | 88 | oos.defaultWriteObject(); |
| 95 | 89 | } |
| 96 | 90 | |
| 97 | 91 | private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { |
| 98 | 92 | // since super class is not Serializable |
| 99 | | id = ois.readLong(); |
| 100 | | final long userId = ois.readLong(); |
| 101 | | user = userId == -1 ? null : User.getById(userId); |
| 102 | | version = ois.readInt(); |
| 103 | | changesetId = ois.readInt(); |
| 104 | | timestamp = ois.readInt(); |
| 105 | | keys = (String[]) ois.readObject(); |
| 106 | | flags = ois.readShort(); |
| | 93 | super.readObjectCommon(ois); |
| 107 | 94 | ois.defaultReadObject(); |
| 108 | 95 | } |
| 109 | 96 | |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/vector/VectorPrimitive.java b/src/org/openstreetmap/josm/data/vector/VectorPrimitive.java
|
a
|
b
|
|
| 58 | 58 | this.highlighted = highlighted; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | | @Override |
| 62 | | public boolean isTagged() { |
| 63 | | return (flags & FLAG_TAGGED) != 0; |
| 64 | | } |
| 65 | | |
| 66 | 61 | @Override |
| 67 | 62 | public boolean isAnnotated() { |
| 68 | 63 | return this.getInterestingTags().size() - this.getKeys().size() > 0; |