Changeset 10608 in josm for trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
- Timestamp:
- 2016-07-23T15:46:39+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r10583 r10608 110 110 111 111 /** 112 * A tagged way that matches this pattern has a direction. 113 * @see #FLAG_HAS_DIRECTIONS 114 */ 115 private static volatile Match directionKeys; 116 117 /** 118 * A tagged way that matches this pattern has a direction that is reversed. 119 * <p> 120 * This pattern should be a subset of {@link #directionKeys} 121 * @see #FLAG_DIRECTION_REVERSED 122 */ 123 private static volatile Match reversedDirectionKeys; 124 125 static { 126 String reversedDirectionDefault = "oneway=\"-1\""; 127 128 String directionDefault = "oneway? | (aerialway=* -aerialway=station) | "+ 129 "waterway=stream | waterway=river | waterway=ditch | waterway=drain | "+ 130 "\"piste:type\"=downhill | \"piste:type\"=sled | man_made=\"piste:halfpipe\" | "+ 131 "junction=roundabout | (highway=motorway & -oneway=no & -oneway=reversible) | "+ 132 "(highway=motorway_link & -oneway=no & -oneway=reversible)"; 133 134 reversedDirectionKeys = compileDirectionKeys("tags.reversed_direction", reversedDirectionDefault); 135 directionKeys = compileDirectionKeys("tags.direction", directionDefault); 136 } 137 138 /** 112 139 * Replies the sub-collection of {@link OsmPrimitive}s of type <code>type</code> present in 113 140 * another collection of {@link OsmPrimitive}s. The result collection is a list. … … 174 201 * @see OsmPrimitive#isUsable() 175 202 */ 176 public static final Predicate<OsmPrimitive> isUsablePredicate = new Predicate<OsmPrimitive>() { 177 @Override 178 public boolean evaluate(OsmPrimitive primitive) { 179 return primitive.isUsable(); 180 } 181 }; 203 public static final Predicate<OsmPrimitive> isUsablePredicate = primitive -> primitive.isUsable(); 182 204 183 205 /** 184 206 * A predicate filtering primitives that are selectable. 185 207 */ 186 public static final Predicate<OsmPrimitive> isSelectablePredicate = new Predicate<OsmPrimitive>() { 187 @Override 188 public boolean evaluate(OsmPrimitive primitive) { 189 return primitive.isSelectable(); 190 } 191 }; 208 public static final Predicate<OsmPrimitive> isSelectablePredicate = primitive -> primitive.isSelectable(); 192 209 193 210 /** 194 211 * A predicate filtering primitives that are not deleted. 195 212 */ 196 public static final Predicate<OsmPrimitive> nonDeletedPredicate = new Predicate<OsmPrimitive>() { 197 @Override public boolean evaluate(OsmPrimitive primitive) { 198 return !primitive.isDeleted(); 199 } 200 }; 213 public static final Predicate<OsmPrimitive> nonDeletedPredicate = primitive -> !primitive.isDeleted(); 201 214 202 215 /** 203 216 * A predicate filtering primitives that are not deleted and not incomplete. 204 217 */ 205 public static final Predicate<OsmPrimitive> nonDeletedCompletePredicate = new Predicate<OsmPrimitive>() { 206 @Override public boolean evaluate(OsmPrimitive primitive) { 207 return !primitive.isDeleted() && !primitive.isIncomplete(); 208 } 209 }; 218 public static final Predicate<OsmPrimitive> nonDeletedCompletePredicate = 219 primitive -> !primitive.isDeleted() && !primitive.isIncomplete(); 210 220 211 221 /** 212 222 * A predicate filtering primitives that are not deleted and not incomplete and that are not a relation. 213 223 */ 214 public static final Predicate<OsmPrimitive> nonDeletedPhysicalPredicate = new Predicate<OsmPrimitive>() { 215 @Override public boolean evaluate(OsmPrimitive primitive) { 216 return !primitive.isDeleted() && !primitive.isIncomplete() && !(primitive instanceof Relation); 217 } 218 }; 224 public static final Predicate<OsmPrimitive> nonDeletedPhysicalPredicate = 225 primitive -> !primitive.isDeleted() && !primitive.isIncomplete() && !(primitive instanceof Relation); 219 226 220 227 /** 221 228 * A predicate filtering primitives that are modified 222 229 */ 223 public static final Predicate<OsmPrimitive> modifiedPredicate = new Predicate<OsmPrimitive>() { 224 @Override public boolean evaluate(OsmPrimitive primitive) { 225 return primitive.isModified(); 226 } 227 }; 230 public static final Predicate<OsmPrimitive> modifiedPredicate = primitive -> primitive.isModified(); 228 231 229 232 /** … … 245 248 * A predicate filtering multipolygon relations. 246 249 */ 247 public static final Predicate<OsmPrimitive> multipolygonPredicate = new Predicate<OsmPrimitive>() { 248 @Override public boolean evaluate(OsmPrimitive primitive) { 249 return primitive.getClass() == Relation.class && ((Relation) primitive).isMultipolygon(); 250 } 251 }; 250 public static final Predicate<OsmPrimitive> multipolygonPredicate = 251 primitive -> primitive.getClass() == Relation.class && ((Relation) primitive).isMultipolygon(); 252 252 253 253 /** … … 256 256 * @see #FLAG_HAS_DIRECTIONS 257 257 */ 258 public static final Predicate<Tag> directionalKeyPredicate = new Predicate<Tag>() { 259 @Override 260 public boolean evaluate(Tag tag) { 261 return directionKeys.match(tag); 262 } 263 }; 258 public static final Predicate<Tag> directionalKeyPredicate = tag -> directionKeys.match(tag); 264 259 265 260 /** … … 843 838 } 844 839 845 /**846 * A tagged way that matches this pattern has a direction.847 * @see #FLAG_HAS_DIRECTIONS848 */849 private static volatile Match directionKeys;850 851 /**852 * A tagged way that matches this pattern has a direction that is reversed.853 * <p>854 * This pattern should be a subset of {@link #directionKeys}855 * @see #FLAG_DIRECTION_REVERSED856 */857 private static volatile Match reversedDirectionKeys;858 859 static {860 String reversedDirectionDefault = "oneway=\"-1\"";861 862 String directionDefault = "oneway? | (aerialway=* -aerialway=station) | "+863 "waterway=stream | waterway=river | waterway=ditch | waterway=drain | "+864 "\"piste:type\"=downhill | \"piste:type\"=sled | man_made=\"piste:halfpipe\" | "+865 "junction=roundabout | (highway=motorway & -oneway=no & -oneway=reversible) | "+866 "(highway=motorway_link & -oneway=no & -oneway=reversible)";867 868 reversedDirectionKeys = compileDirectionKeys("tags.reversed_direction", reversedDirectionDefault);869 directionKeys = compileDirectionKeys("tags.direction", directionDefault);870 }871 872 840 private static Match compileDirectionKeys(String prefName, String defaultValue) throws AssertionError { 873 841 try {
Note:
See TracChangeset
for help on using the changeset viewer.