- Timestamp:
- 2010-03-19T22:21:52+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r3116 r3147 163 163 164 164 /** 165 * @return A collection containing all primitives of the dataset. The data is ordered after: 166 * first come nodes, then ways, then relations. Ordering in between the categories is not 167 * guaranteed. 168 */ 169 public List<OsmPrimitive> allPrimitives() { 170 List<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 171 o.addAll(nodes); 172 o.addAll(ways); 173 o.addAll(relations); 174 return o; 165 * @return A collection containing all primitives of the dataset. Data are not ordered 166 */ 167 public Collection<OsmPrimitive> allPrimitives() { 168 return Collections.unmodifiableCollection(allPrimitives); 175 169 } 176 170 … … 179 173 */ 180 174 public Collection<OsmPrimitive> allNonDeletedPrimitives() { 181 Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 182 for (OsmPrimitive osm : allPrimitives()) 183 if (osm.isVisible() && !osm.isDeleted()) { 184 o.add(osm); 185 } 186 return o; 175 return new DatasetCollection.AllNonDeleted(allPrimitives); 187 176 } 188 177 189 178 public Collection<OsmPrimitive> allNonDeletedCompletePrimitives() { 190 Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 191 for (OsmPrimitive osm : allPrimitives()) 192 if (osm.isVisible() && !osm.isDeleted() && !osm.isIncomplete()) { 193 o.add(osm); 194 } 195 return o; 179 return new DatasetCollection.AllNonDeletedComplete(allPrimitives); 196 180 } 197 181 198 182 public Collection<OsmPrimitive> allNonDeletedPhysicalPrimitives() { 199 Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 200 for (OsmPrimitive osm : allPrimitives()) 201 if (osm.isVisible() && !osm.isDeleted() && !osm.isIncomplete() && !(osm instanceof Relation)) { 202 o.add(osm); 203 } 204 return o; 183 return new DatasetCollection.AllNonDeletedPhysical(allPrimitives); 205 184 } 206 185 … … 209 188 */ 210 189 public Collection<OsmPrimitive> allModifiedPrimitives() { 211 Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 212 for (OsmPrimitive osm : allPrimitives()) { 213 if (osm.isVisible() && osm.isModified()) { 214 o.add(osm); 215 } 216 } 217 return o; 190 return new DatasetCollection.AllModified(allPrimitives); 218 191 } 219 192
Note:
See TracChangeset
for help on using the changeset viewer.