Changeset 7445 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-08-27T02:41:05+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10416 - conditional keys: add maxstay restriction + detect another case of invalid syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java

    r7005 r7445  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    5 import org.openstreetmap.josm.data.validation.Severity;
    6 import org.openstreetmap.josm.data.validation.Test;
    7 import org.openstreetmap.josm.data.validation.TestError;
    8 import org.openstreetmap.josm.tools.Predicates;
    9 import org.openstreetmap.josm.tools.Utils;
     4import static org.openstreetmap.josm.tools.I18n.tr;
    105
    116import java.util.ArrayList;
     
    1813import java.util.regex.Pattern;
    1914
    20 import static org.openstreetmap.josm.tools.I18n.tr;
     15import org.openstreetmap.josm.data.osm.OsmPrimitive;
     16import org.openstreetmap.josm.data.validation.Severity;
     17import org.openstreetmap.josm.data.validation.Test;
     18import org.openstreetmap.josm.data.validation.TestError;
     19import org.openstreetmap.josm.tools.Predicates;
     20import org.openstreetmap.josm.tools.Utils;
    2121
     22/**
     23 * Checks for <a href="http://wiki.openstreetmap.org/wiki/Conditional_restrictions">conditional restrictions</a>
     24 * @since 6605
     25 */
    2226public class ConditionalKeys extends Test.TagTest {
    2327
    2428    final OpeningHourTest openingHourTest = new OpeningHourTest();
    25     static final Set<String> RESTRICTION_TYPES = new HashSet<>(Arrays.asList("oneway", "toll", "noexit", "maxspeed", "minspeed",
     29    static final Set<String> RESTRICTION_TYPES = new HashSet<>(Arrays.asList("oneway", "toll", "noexit", "maxspeed", "minspeed", "maxstay",
    2630            "maxweight", "maxaxleload", "maxheight", "maxwidth", "maxlength", "overtaking", "maxgcweight", "maxgcweightrating", "fee"));
    2731    static final Set<String> RESTRICTION_VALUES = new HashSet<>(Arrays.asList("yes", "official", "designated", "destination",
     
    141145    public List<TestError> validatePrimitive(OsmPrimitive p) {
    142146        final List<TestError> errors = new ArrayList<>();
    143         for (final String key : Utils.filter(p.keySet(), Predicates.stringMatchesPattern(Pattern.compile(".*:conditional$")))) {
     147        for (final String key : Utils.filter(p.keySet(), Predicates.stringMatchesPattern(Pattern.compile(".*:conditional(:.*)?$")))) {
    144148            if (!isKeyValid(key)) {
    145149                errors.add(new TestError(this, Severity.WARNING, tr("Wrong syntax in {0} key", key), 3201, p));
Note: See TracChangeset for help on using the changeset viewer.