Changeset 7167 in josm for trunk/src


Ignore:
Timestamp:
2014-05-22T17:13:04+02:00 (6 years ago)
Author:
simon04
Message:

MapCSS: simplify ~= implementation, add unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r7099 r7167  
    33
    44import java.text.MessageFormat;
     5import java.util.Arrays;
    56import java.util.EnumSet;
    67import java.util.Objects;
     
    9596                return REGEX.equals(this) ? contains : !contains;
    9697            case ONE_OF:
    97                 String[] parts = testString.split(";");
    98                 for (String part : parts) {
    99                     if (Objects.equals(prototypeString, part.trim()))
    100                         return true;
    101                 }
    102                 return false;
     98                return Arrays.asList(testString.split("\\s*;\\s*")).contains(prototypeString);
    10399            case BEGINS_WITH:
    104100                return testString.startsWith(prototypeString);
Note: See TracChangeset for help on using the changeset viewer.