Changeset 7055 in josm for trunk/src/org
- Timestamp:
- 2014-05-03T10:41:01+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r7033 r7055 232 232 final Tag tag = c instanceof Condition.KeyCondition 233 233 ? ((Condition.KeyCondition) c).asTag() 234 : c instanceof Condition.SimpleKeyValueCondition 235 ? ((Condition.SimpleKeyValueCondition) c).asTag() 234 236 : c instanceof Condition.KeyValueCondition 235 237 ? ((Condition.KeyValueCondition) c).asTag() -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r7012 r7055 29 29 switch (context) { 30 30 case PRIMITIVE: 31 return KeyValueRegexpCondition.SUPPORTED_OPS.contains(op) && !considerValAsKey 32 ? new KeyValueRegexpCondition(k, v, op, false) 33 : new KeyValueCondition(k, v, op, considerValAsKey); 31 if (KeyValueRegexpCondition.SUPPORTED_OPS.contains(op) && !considerValAsKey) 32 return new KeyValueRegexpCondition(k, v, op, false); 33 if (!considerValAsKey && op.equals(Op.EQ)) 34 return new SimpleKeyValueCondition(k, v); 35 return new KeyValueCondition(k, v, op, considerValAsKey); 34 36 case LINK: 35 37 if (considerValAsKey) … … 150 152 151 153 /** 154 * Most common case of a KeyValueCondition. 155 * 156 * Extra class for performance reasons. 157 */ 158 public static class SimpleKeyValueCondition extends Condition { 159 public final String k; 160 public final String v; 161 162 public SimpleKeyValueCondition(String k, String v) { 163 this.k = k; 164 this.v = v; 165 } 166 167 @Override 168 public boolean applies(Environment e) { 169 return v.equals(e.osm.get(k)); 170 } 171 172 public Tag asTag() { 173 return new Tag(k, v); 174 } 175 } 176 177 /** 152 178 * <p>Represents a key/value condition which is either applied to a primitive.</p> 153 179 * -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r7054 r7055 525 525 return subpart; 526 526 } 527 527 528 @Override 528 529 public Range getRange() {
Note:
See TracChangeset
for help on using the changeset viewer.