Changeset 2070 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2009-09-06T23:07:33+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r1990 r2070 30 30 31 31 public int compareTo(OsmPrimitive other) { 32 if (other instanceof Changeset) return Long.valueOf( id).compareTo(other.id);32 if (other instanceof Changeset) return Long.valueOf(getId()).compareTo(other.getId()); 33 33 return 1; 34 34 } … … 37 37 public String getName() { 38 38 // no translation 39 return "changeset " + id;39 return "changeset " + getId(); 40 40 } 41 41 42 42 @Override 43 43 public String getLocalName(){ 44 return tr("Changeset {0}", id);44 return tr("Changeset {0}",getId()); 45 45 } 46 46 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2025 r2070 373 373 protected void deleteWay(Way way) { 374 374 way.setNodes(null); 375 way. delete(true);375 way.setDeleted(true); 376 376 } 377 377 … … 471 471 return false; 472 472 } 473 474 public Set<Relation> getReferringRelations(Collection<? extends OsmPrimitive> primitives) { 475 HashSet<Relation> ret = new HashSet<Relation>(); 476 if (primitives == null) return ret; 477 Set<? extends OsmPrimitive> referred; 478 if (primitives instanceof Set<?>) { 479 referred = (Set<? extends OsmPrimitive>)primitives; 480 } else { 481 referred = new HashSet<OsmPrimitive>(primitives); 482 } 483 referred.remove(null); // just in case - remove null element from primitives 484 for (Relation r: relations) { 485 if (r.isDeleted() || r.incomplete) { 486 continue; 487 } 488 Set<OsmPrimitive> memberPrimitives = r.getMemberPrimitives(); 489 memberPrimitives.retainAll(referred); 490 if (!memberPrimitives.isEmpty()) { 491 ret.add(r); 492 } 493 } 494 return ret; 495 } 473 496 } -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r2017 r2070 17 17 18 18 public final void setCoor(LatLon coor) { 19 if(coor != null) 20 { 19 if(coor != null){ 21 20 if(this.coor == null) { 22 21 this.coor = new CachedLatLon(coor); … … 47 46 48 47 48 /** 49 * Create a new local node with id 0. 50 * 51 */ 52 public Node() { 53 this(0); 54 } 55 49 56 50 57 /** … … 52 59 */ 53 60 public Node(long id) { 54 this.id = id; 55 incomplete = true; 61 super(id); 56 62 } 57 63 … … 60 66 */ 61 67 public Node(Node clone) { 68 super(clone.getId()); 62 69 cloneFrom(clone); 63 70 } 64 71 65 72 public Node(LatLon latlon) { 73 super(0); 66 74 setCoor(latlon); 67 75 } 68 76 69 77 public Node(EastNorth eastNorth) { 78 super(0); 70 79 setEastNorth(eastNorth); 71 80 } … … 81 90 82 91 @Override public String toString() { 83 if (coor == null) return "{Node id="+ id+"}";84 return "{Node id="+ id+",version="+version+",lat="+coor.lat()+",lon="+coor.lon()+"}";92 if (coor == null) return "{Node id="+getId()+"}"; 93 return "{Node id="+getId()+",version="+getVersion()+",lat="+coor.lat()+",lon="+coor.lon()+"}"; 85 94 } 86 95 … … 101 110 102 111 public int compareTo(OsmPrimitive o) { 103 return o instanceof Node ? Long.valueOf( id).compareTo(o.id) : 1;112 return o instanceof Node ? Long.valueOf(getId()).compareTo(o.getId()) : 1; 104 113 } 105 114 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2067 r2070 10 10 import java.util.Date; 11 11 import java.util.HashMap; 12 import java.util.HashSet; 13 import java.util.LinkedList; 14 import java.util.List; 12 15 import java.util.Locale; 13 16 import java.util.Map; 17 import java.util.Set; 14 18 import java.util.Map.Entry; 15 19 … … 31 35 abstract public class OsmPrimitive implements Comparable<OsmPrimitive> { 32 36 37 static public <T extends OsmPrimitive> List<T> getFilteredList(Collection<OsmPrimitive> list, Class<T> type) { 38 if (list == null) return null; 39 List<T> ret = new LinkedList<T>(); 40 for(OsmPrimitive p: list) { 41 if (type.isInstance(p)) { 42 ret.add(type.cast(p)); 43 } 44 } 45 return ret; 46 } 47 48 static public <T extends OsmPrimitive> Set<T> getFilteredSet(Collection<OsmPrimitive> set, Class<T> type) { 49 if (set == null) return null; 50 HashSet<T> ret = new HashSet<T>(); 51 for(OsmPrimitive p: set) { 52 if (type.isInstance(p)) { 53 ret.add(type.cast(p)); 54 } 55 } 56 return ret; 57 } 58 59 33 60 /* mappaint data */ 34 61 public ElemStyle mappaintStyle = null; … … 70 97 * the respective class. 71 98 * 72 * @deprecated use {@see #getId()}. Don't assign an id, create a primitive with 99 * @deprecated use {@see #getId()} and {@see #setId()}. Don't assign an id, create a primitive with 73 100 * the respective constructors. 74 101 */ … … 120 147 121 148 /** 149 * If set to true, this object is incomplete, which means only the id 150 * and type is known (type is the objects instance class) 151 */ 152 public boolean incomplete = false; 153 154 /** 155 * Contains the version number as returned by the API. Needed to 156 * ensure update consistency 157 * @deprecated use {@see #getVersion()} and {@see #setVersion(long)} 158 */ 159 @Deprecated 160 public int version = 0; 161 162 163 /** 164 * Creates a new primitive with id 0. 165 * 166 */ 167 public OsmPrimitive() { 168 this(0); 169 } 170 171 /** 172 * Creates a new primitive for the given id. If the id > 0, the primitive is marked 173 * as incomplete. 174 * 175 * @param id the id. > 0 required 176 * @throws IllegalArgumentException thrown if id < 0 177 */ 178 public OsmPrimitive(long id) throws IllegalArgumentException { 179 if (id < 0) 180 throw new IllegalArgumentException(tr("expected id >= 0. Got {0}", id)); 181 this.id = id; 182 this.version = 0; 183 this.incomplete = id >0; 184 } 185 186 /* ------------------------------------------------------------------------------------ */ 187 /* accessors */ 188 /* ------------------------------------------------------------------------------------ */ 189 190 /** 122 191 * Sets whether this primitive is selected or not. 123 192 * … … 162 231 * 163 232 * @return <code>true</code>, if the object has been deleted. 164 * @see # delete(boolean)233 * @see #setDeleted(boolean) 165 234 */ 166 235 public boolean isDeleted() { … … 205 274 206 275 /** 276 * Replies the version number as returned by the API. The version is 0 if the id is 0 or 277 * if this primitive is incomplete. 278 * 279 * @see #setVersion(int) 280 */ 281 public long getVersion() { 282 return version; 283 } 284 285 /** 207 286 * Replies the id of this primitive. 208 287 * … … 214 293 215 294 /** 216 * If set to true, this object is highlighted. Currently this is only used to 217 * show which ways/nodes will connect 218 */ 219 public volatile boolean highlighted = false; 220 221 private int timestamp; 295 * Sets the id and the version of this primitive if it is known to the OSM API. 296 * 297 * Since we know the id and its version it can't be incomplete anymore. incomplete 298 * is set to false. 299 * 300 * @param id the id. > 0 required 301 * @param version the version > 0 required 302 * @throws IllegalArgumentException thrown if id <= 0 303 * @throws IllegalArgumentException thrown if version <= 0 304 */ 305 public void setOsmId(long id, int version) { 306 if (id <= 0) 307 throw new IllegalArgumentException(tr("id > 0 expected. Got {0}", id)); 308 if (version <= 0) 309 throw new IllegalArgumentException(tr("version > 0 expected. Got {0}", version)); 310 this.id = id; 311 this.version = version; 312 this.incomplete = false; 313 } 314 315 /** 316 * Clears the id and version known to the OSM API. The id and the version is set to 0. 317 * incomplete is set to false. 318 * 319 * <strong>Caution</strong>: Do not use this method on primitives which are already added to a {@see DataSet}. 320 * Ways and relations might already refer to the primitive and clearing the OSM ID 321 * result in corrupt data. 322 * 323 * Here's an example use case: 324 * <pre> 325 * // create a clone of an already existing node 326 * Node copy = new Node(otherExistingNode); 327 * 328 * // reset the clones OSM id 329 * copy.clearOsmId(); 330 * </pre> 331 * 332 */ 333 public void clearOsmId() { 334 this.id = 0; 335 this.version = 0; 336 this.incomplete = false; 337 } 222 338 223 339 public void setTimestamp(Date timestamp) { … … 240 356 241 357 /** 242 * If set to true, this object is incomplete, which means only the id 243 * and type is known (type is the objects instance class) 244 */ 245 public boolean incomplete = false; 246 247 /** 248 * Contains the version number as returned by the API. Needed to 249 * ensure update consistency 250 */ 251 public int version = -1; 358 * If set to true, this object is highlighted. Currently this is only used to 359 * show which ways/nodes will connect 360 */ 361 public volatile boolean highlighted = false; 362 363 private int timestamp; 252 364 253 365 private static Collection<String> uninteresting = null; … … 288 400 abstract public void visit(Visitor visitor); 289 401 290 public final void delete(boolean deleted) { 402 /** 403 * Sets whether this primitive is deleted or not. 404 * 405 * Also marks this primitive as modified if deleted is true and sets selected to false. 406 * 407 * @param deleted true, if this primitive is deleted; false, otherwise 408 */ 409 public void setDeleted(boolean deleted) { 410 this.modified = deleted; 291 411 this.deleted = deleted; 292 setSelected(false); 293 modified = true; 412 this.selected = false; 294 413 } 295 414 -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r2017 r2070 2 2 3 3 import java.util.ArrayList; 4 import java.util.HashSet; 4 5 import java.util.List; 6 import java.util.Set; 5 7 6 8 import org.openstreetmap.josm.data.osm.visitor.Visitor; … … 17 19 * All members of this relation. Note that after changing this, 18 20 * makeBackReferences and/or removeBackReferences should be called. 19 */ 21 * 22 * @deprecated use the improved API instead of accessing this list directly 23 */ 24 @Deprecated 20 25 public final List<RelationMember> members = new ArrayList<RelationMember>(); 21 26 … … 104 109 105 110 /** 111 * Create a new relation with id 0 112 */ 113 public Relation() { 114 115 } 116 117 /** 106 118 * Create an identical clone of the argument (including the id) 107 119 */ 108 120 public Relation(Relation clone) { 121 super(clone.getId()); 109 122 cloneFrom(clone); 110 123 } 111 124 112 125 /** 113 * Create an incomplete Relation. 114 */ 115 public Relation(long id) { 116 this.id = id; 117 incomplete = true; 118 } 119 120 /** 121 * Create an empty Relation. Use this only if you set meaningful values 122 * afterwards. 123 */ 124 public Relation() { 125 } 126 * Creates a new relation for the given id. If the id > 0, the way is marked 127 * as incomplete. 128 * 129 * @param id the id. > 0 required 130 * @throws IllegalArgumentException thrown if id < 0 131 */ 132 public Relation(long id) throws IllegalArgumentException { 133 super(id); 134 } 135 126 136 127 137 @Override public void cloneFrom(OsmPrimitive osm) { … … 138 148 // return "{Relation id="+id+" version="+version+" members="+Arrays.toString(members.toArray())+"}"; 139 149 // adding members in string increases memory usage a lot and overflows for looped relations 140 return "{Relation id="+ id+" version="+version+"}";150 return "{Relation id="+getId()+" version="+getVersion()+"}"; 141 151 } 142 152 … … 152 162 153 163 public int compareTo(OsmPrimitive o) { 154 return o instanceof Relation ? Long.valueOf( id).compareTo(o.id) : -1;164 return o instanceof Relation ? Long.valueOf(getId()).compareTo(o.getId()) : -1; 155 165 } 156 166 … … 158 168 public boolean isIncomplete() { 159 169 for (RelationMember m : members) 160 if (m. member== null)170 if (m.getMember() == null) 161 171 return true; 162 172 return false; … … 183 193 ArrayList<RelationMember> todelete = new ArrayList<RelationMember>(); 184 194 for (RelationMember member: members) { 185 if (member. member== primitive) {195 if (member.getMember() == primitive) { 186 196 todelete.add(member); 187 197 } … … 194 204 return formatter.format(this); 195 205 } 206 207 /** 208 * Replies the set of {@see OsmPrimitive}s referred to by at least one 209 * member of this relation 210 * 211 * @return the set of {@see OsmPrimitive}s referred to by at least one 212 * member of this relation 213 */ 214 public Set<OsmPrimitive> getMemberPrimitives() { 215 HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 216 for (RelationMember m: members) { 217 if (m.getMember() != null) { 218 ret.add(m.getMember()); 219 } 220 } 221 return ret; 222 } 196 223 } -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r1937 r2070 6 6 * list is not sufficient. 7 7 * 8 * @author Frederik Ramm <frederik@remote.org>9 8 */ 10 9 public class RelationMember { 11 10 11 /** 12 * 13 * @deprecated use {@see #getRole()} or create a clone in order to assign a new role 14 */ 15 @Deprecated 12 16 public String role; 17 18 /** 19 * 20 * @deprecated use {@see #getMember()} or create a clone in order to assign a new member 21 */ 22 @Deprecated 13 23 public OsmPrimitive member; 14 24 … … 19 29 */ 20 30 public String getRole() { 21 if (role == null) {31 if (role == null) 22 32 return ""; 23 } else { 24 return role; 25 } 33 return role; 26 34 } 27 35 … … 45 53 46 54 /** 47 * 48 * @return True if member is way 49 * @since 1937 50 */ 55 * 56 * @return True if member is way 57 * @since 1937 58 */ 51 59 public boolean isWay() { 52 60 return member instanceof Way; … … 54 62 55 63 /** 56 * 57 * @return True if member is node 58 * @since 1937 59 */ 64 * 65 * @return True if member is node 66 * @since 1937 67 */ 60 68 public boolean isNode() { 61 69 return member instanceof Node; … … 72 80 73 81 /** 74 * 75 * @return Member as way 76 * @since 1937 77 */ 82 * 83 * @return Member as way 84 * @since 1937 85 */ 78 86 public Way getWay() { 79 87 return (Way)member; … … 81 89 82 90 /** 83 * 84 * @return Member as node 85 * @since 1937 86 */ 91 * 92 * @return Member as node 93 * @since 1937 94 */ 87 95 public Node getNode() { 88 96 return (Node)member; … … 90 98 91 99 /** 92 * 93 * @return Member 94 * @since 1937 95 */ 100 * 101 * @return Member 102 * @since 1937 103 */ 96 104 public OsmPrimitive getMember() { 97 105 return member; … … 101 109 /** 102 110 * Default constructor. Does nothing. 103 * @deprecated Use other constructors because RelationMember class will bec ame immutable111 * @deprecated Use other constructors because RelationMember class will become immutable 104 112 * in the future 105 113 */ -
trunk/src/org/openstreetmap/josm/data/osm/Tag.java
r2008 r2070 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import java.util.ArrayList; 5 import java.util.Collections; 6 import java.util.Iterator; 7 import java.util.List; 3 8 4 9 /** … … 27 32 */ 28 33 public Tag(String key) { 34 this(); 29 35 this.key = key == null ? "" : key; 30 36 } -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r2017 r2070 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.Collections; 8 9 import java.util.HashMap; 9 10 import java.util.HashSet; … … 571 572 throw new IllegalStateException(tr("tag collection can't be applied to a primitive because there are keys with multiple values")); 572 573 for (Tag tag: tags) { 573 primitive.put(tag.getKey(), tag.getValue()); 574 if (tag.getValue() == null || tag.getValue().equals("")) { 575 primitive.remove(tag.getKey()); 576 } else { 577 primitive.put(tag.getKey(), tag.getValue()); 578 } 574 579 } 575 580 } … … 682 687 return ret; 683 688 } 689 690 /** 691 * Replies the concatenation of all tag values (concatenated by a semicolon) 692 * 693 * @return the concatenation of all tag values 694 */ 695 public String getJoinedValues(String key) { 696 StringBuffer buffer = new StringBuffer(); 697 List<String> values = new ArrayList<String>(getValues(key)); 698 values.remove(""); 699 Collections.sort(values); 700 Iterator<String> iter = values.iterator(); 701 while (iter.hasNext()) { 702 buffer.append(iter.next()); 703 if (iter.hasNext()) { 704 buffer.append(";"); 705 } 706 } 707 return buffer.toString(); 708 } 684 709 } -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r2034 r2070 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import java.util.ArrayList; 4 5 import java.util.HashMap; 6 import java.util.List; 5 7 6 8 /** … … 11 13 * is only one user object. 12 14 * 13 * @author fred14 15 * 15 16 */ 16 17 public class User { 18 static private long uidCounter = 0; 19 /** 20 * the map of known users 21 */ 22 private static HashMap<Long,User> userMap = new HashMap<Long,User>(); 17 23 18 /** storage for existing User objects. */19 private static HashMap<String,User> userMap = new HashMap<String,User>();20 24 21 /** the username. */ 22 public String name; 25 private static long getNextLocalUid() { 26 synchronized(User.class) { 27 uidCounter--; 28 return uidCounter; 29 } 30 } 23 31 24 /** the user ID (since API 0.6) */ 25 public String uid; 32 /** 33 * Creates a local user with the given name 34 * 35 * @param name the name 36 */ 37 public static User createLocalUser(String name) { 38 User user = new User(getNextLocalUid(), name); 39 userMap.put(user.getId(), user); 40 return user; 41 } 42 43 /** 44 * Creates a user known to the OSM server 45 * 46 * @param uid the user id 47 * @param name the name 48 */ 49 public static User createOsmUser(long uid, String name) { 50 User user = new User(uid, name); 51 userMap.put(user.getId(), user); 52 return user; 53 } 54 55 56 /** 57 * Returns the user with user id <code>uid</code> or null if this user doesn't exist 58 * 59 * @param uid the user id 60 * @return the user; null, if there is no user with this id 61 */ 62 public static User getById(long uid) { 63 return userMap.get(uid); 64 } 65 66 /** 67 * Returns the list of users with name <code>name</code> or the empty list if 68 * no such users exist 69 * 70 * @param name the user name 71 * @return the list of users with name <code>name</code> or the empty list if 72 * no such users exist 73 */ 74 public static List<User> getByName(String name) { 75 name = name == null ? "" : name; 76 List<User> ret = new ArrayList<User>(); 77 for (User user: userMap.values()) { 78 if (user.getName().equals(name)) { 79 ret.add(user); 80 } 81 } 82 return ret; 83 } 84 85 /** the user name */ 86 private String name; 87 /** the user id */ 88 private long uid; 89 90 /** 91 * Replies the user name 92 * 93 * @return the user name. Never null, but may be the empty string 94 */ 95 public String getName() { 96 return name == null ? "" : name; 97 } 98 99 /** 100 * Replies the user id. If this user is known to the OSM server the positive user id 101 * from the server is replied. Otherwise, a negative local value is replied. 102 * 103 * A negative local is only unique during an editing session. It is lost when the 104 * application is closed and there is no guarantee that a negative local user id is 105 * always bound to a user with the same name. 106 * 107 */ 108 public long getId() { 109 return uid; 110 } 26 111 27 112 /** private constructor, only called from get method. */ 28 private User(String name) { 113 private User(long uid, String name) { 114 this.uid = uid; 29 115 this.name = name; 30 116 } 31 117 32 /** returns a new or existing User object that represents the given name. */ 33 public static User get(String name) { 34 User user = userMap.get(name); 35 if (user == null) { 36 user = new User(name); 37 userMap.put(name, user); 38 } 39 return user; 118 public boolean isOsmUser() { 119 return uid > 0; 120 } 121 122 public boolean isLocalUser() { 123 return uid < 0; 40 124 } 41 125 … … 45 129 int result = 1; 46 130 result = prime * result + ((name == null) ? 0 : name.hashCode()); 47 result = prime * result + ( (uid == null) ? 0 : uid.hashCode());131 result = prime * result + (int) (uid ^ (uid >>> 32)); 48 132 return result; 49 133 } … … 63 147 } else if (!name.equals(other.name)) 64 148 return false; 65 if (uid == null) { 66 if (other.uid != null) 67 return false; 68 } else if (!uid.equals(other.uid)) 149 if (uid != other.uid) 69 150 return false; 70 151 return true; -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r2017 r2070 119 119 120 120 /** 121 * Creates a new way with id 0. 122 * 123 */ 124 public Way(){ 125 } 126 127 /** 121 128 * Create an identical clone of the argument (including the id). 122 129 * … … 124 131 */ 125 132 public Way(Way original) { 133 super(original.getId()); 126 134 cloneFrom(original); 127 135 } 128 136 129 137 /** 130 * Create an empty way without id. Use this only if you set meaningful 131 * values yourself. 132 */ 133 public Way() { 134 } 135 136 /** 137 * Create an incomplete Way with a given id. 138 * 139 * @param id the id. id > 0 required. 140 */ 141 public Way(long id) { 142 // FIXME: shouldn't we check for id > 0? 143 // 144 this.id = id; 145 incomplete = true; 138 * Creates a new way for the given id. If the id > 0, the way is marked 139 * as incomplete. 140 * 141 * @param id the id. > 0 required 142 * @throws IllegalArgumentException thrown if id < 0 143 */ 144 public Way(long id) throws IllegalArgumentException { 145 super(id); 146 146 } 147 147 … … 153 153 154 154 @Override public String toString() { 155 if (incomplete) return "{Way id="+ id+" version="+version+" (incomplete)}";156 return "{Way id="+ id+" version="+version+" nodes="+Arrays.toString(nodes.toArray())+"}";155 if (incomplete) return "{Way id="+getId()+" version="+getVersion()+" (incomplete)}"; 156 return "{Way id="+getId()+" version="+getVersion()+" nodes="+Arrays.toString(nodes.toArray())+"}"; 157 157 } 158 158 … … 170 170 if (o instanceof Relation) 171 171 return 1; 172 return o instanceof Way ? Long.valueOf( id).compareTo(o.id) : -1;172 return o instanceof Way ? Long.valueOf(getId()).compareTo(o.getId()) : -1; 173 173 } 174 174 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/CollectBackReferencesVisitor.java
r1937 r2070 46 46 public void visit(Node n) { 47 47 for (Way w : ds.ways) { 48 if (w.deleted || w.incomplete) continue; 48 if (w.isDeleted() || w.incomplete) { 49 continue; 50 } 49 51 for (Node n2 : w.getNodes()) { 50 52 if (n == n2) { … … 72 74 // references. 73 75 for (Relation r : ds.relations) { 74 if (r.incomplete || r.deleted) continue; 76 if (r.incomplete || r.isDeleted()) { 77 continue; 78 } 75 79 for (RelationMember m : r.getMembers()) { 76 80 if (m.getMember() == p) { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r2025 r2070 236 236 if (myPrimitivesWithDefinedIds.containsKey(other.getId())) { 237 237 P my = myPrimitivesWithDefinedIds.get(other.getId()); 238 if (my. version<= other.version) {238 if (my.getVersion() <= other.getVersion()) { 239 239 if (! my.isVisible() && other.isVisible()) { 240 240 // should not happen … … 243 243 + "their primitive with lower version {2} is not visible. " 244 244 + "Can't deal with this inconsistency. Keeping my primitive. ", 245 Long.toString(my.getId()),Long.toString(my. version), Long.toString(other.version)245 Long.toString(my.getId()),Long.toString(my.getVersion()), Long.toString(other.getVersion()) 246 246 )); 247 247 merged.put(other, my); … … 270 270 // 271 271 merged.put(other, my); 272 } else if (my.isDeleted() && ! other.isDeleted() && my. version== other.version) {272 } else if (my.isDeleted() && ! other.isDeleted() && my.getVersion() == other.getVersion()) { 273 273 // same version, but my is deleted. Assume mine takes precedence 274 274 // otherwise too many conflicts when refreshing from the server … … 288 288 my.cloneFrom(other); 289 289 merged.put(other, my); 290 } else if (! my.isModified() && !other.isModified() && my. version== other.version) {290 } else if (! my.isModified() && !other.isModified() && my.getVersion() == other.getVersion()) { 291 291 // both not modified. Keep mine 292 292 // 293 293 merged.put(other,my); 294 } else if (! my.isModified() && !other.isModified() && my. version< other.version) {294 } else if (! my.isModified() && !other.isModified() && my.getVersion() < other.getVersion()) { 295 295 // my not modified but other is newer. clone other onto mine. 296 296 // 297 297 my.cloneFrom(other); 298 298 merged.put(other,my); 299 } else if (my.isModified() && ! other.isModified() && my. version== other.version) {299 } else if (my.isModified() && ! other.isModified() && my.getVersion() == other.getVersion()) { 300 300 // my is same as other but mine is modified 301 301 // => keep mine
Note:
See TracChangeset
for help on using the changeset viewer.