Changeset 2320 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-10-25T19:01:00+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r2273 r2320 59 59 } 60 60 if (osm.isNew() && !osm.isDeleted()) { 61 toAdd.add Last(osm);61 toAdd.add(osm); 62 62 } else if (osm.isModified() && !osm.isDeleted()) { 63 toUpdate.add Last(osm);63 toUpdate.add(osm); 64 64 } else if (osm.isDeleted() && !osm.isNew() && osm.isModified()) { 65 toDelete.add First(osm);65 toDelete.add(osm); 66 66 } 67 67 } 68 68 sortDeleted(); 69 sortNew(); 69 70 } 70 71 … … 92 93 else if (o2 instanceof Way && o1 instanceof Relation) 93 94 return -1; 95 96 return 0; 97 } 98 } 99 ); 100 } 101 102 /** 103 * Ensures that primitives are added in the following order: Nodes, then Ways, 104 * then Relations. 105 * 106 */ 107 protected void sortNew() { 108 Collections.sort( 109 toAdd, 110 new Comparator<OsmPrimitive>() { 111 public int compare(OsmPrimitive o1, OsmPrimitive o2) { 112 if (o1 instanceof Node && o2 instanceof Node) 113 return 0; 114 else if (o1 instanceof Node) 115 return -1; 116 else if (o2 instanceof Node) 117 return 1; 118 119 if (o1 instanceof Way && o2 instanceof Way) 120 return 0; 121 else if (o1 instanceof Way && o2 instanceof Relation) 122 return -1; 123 else if (o2 instanceof Way && o1 instanceof Relation) 124 return 1; 94 125 95 126 return 0; … … 127 158 } 128 159 } 160 sortNew(); 129 161 sortDeleted(); 130 162 }
Note:
See TracChangeset
for help on using the changeset viewer.