Changeset 19048 in josm for trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
- Timestamp:
- 2024-04-19T16:21:11+02:00 (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
r18877 r19048 23 23 import java.util.function.Predicate; 24 24 import java.util.function.Supplier; 25 import java.util.regex.Matcher;26 25 import java.util.regex.Pattern; 27 26 import java.util.regex.PatternSyntaxException; … … 160 159 @Override 161 160 public Match get(String keyword, boolean caseSensitive, boolean regexSearch, PushbackTokenizer tokenizer) throws SearchParseError { 162 switch (keyword) {161 switch (keyword) { 163 162 case MODIFIED: 164 163 return new Modified(); … … 1140 1139 value = Normalizer.normalize(value, Normalizer.Form.NFC); 1141 1140 1142 Matcher keyMatcher = searchRegex.matcher(key);1143 Matcher valMatcher = searchRegex.matcher(value);1141 final var keyMatcher = searchRegex.matcher(key); 1142 final var valMatcher = searchRegex.matcher(value); 1144 1143 1145 1144 boolean keyMatchFound = keyMatcher.find(); … … 1623 1622 * Matches objects that are new (i.e. have not been uploaded to the server) 1624 1623 */ 1625 private static class New extends Match {1624 private static final class New extends Match { 1626 1625 @Override 1627 1626 public boolean match(OsmPrimitive osm) { … … 1638 1637 * Matches all objects that have been modified, created, or undeleted 1639 1638 */ 1640 private static class Modified extends Match {1639 private static final class Modified extends Match { 1641 1640 @Override 1642 1641 public boolean match(OsmPrimitive osm) { … … 1653 1652 * Matches all objects that have been deleted 1654 1653 */ 1655 private static class Deleted extends Match {1654 private static final class Deleted extends Match { 1656 1655 @Override 1657 1656 public boolean match(OsmPrimitive osm) { … … 1668 1667 * Matches all objects currently selected 1669 1668 */ 1670 private static class Selected extends Match {1669 private static final class Selected extends Match { 1671 1670 @Override 1672 1671 public boolean match(OsmPrimitive osm) { … … 1685 1684 * fetched from the server. 1686 1685 */ 1687 private static class Incomplete extends Match {1686 private static final class Incomplete extends Match { 1688 1687 @Override 1689 1688 public boolean match(OsmPrimitive osm) { … … 1702 1701 * org.openstreetmap.josm.data.osm.OsmPrimitive.getUninterestingKeys() 1703 1702 */ 1704 private static class Untagged extends Match {1703 private static final class Untagged extends Match { 1705 1704 @Override 1706 1705 public boolean match(OsmPrimitive osm) { … … 1717 1716 * Matches ways which are closed (i.e. first and last node are the same) 1718 1717 */ 1719 private static class Closed extends Match {1718 private static final class Closed extends Match { 1720 1719 @Override 1721 1720 public boolean match(OsmPrimitive osm) { … … 1818 1817 if (!(osm instanceof Way)) 1819 1818 return null; 1820 Wayway = (Way) osm;1819 final var way = (Way) osm; 1821 1820 return (long) way.getLength(); 1822 1821 } … … 1971 1970 1972 1971 try { 1973 StringgroupSuffix = name.substring(0, name.length() - 2); // try to remove '/*'1972 final var groupSuffix = name.substring(0, name.length() - 2); // try to remove '/*' 1974 1973 TaggingPresetMenu group = preset.group; 1975 1974 … … 2179 2178 } else if (tokenizer.readIfEqual(Token.COLON)) { 2180 2179 // see if we have a Match that takes a data parameter 2181 SimpleMatchFactoryfactory = simpleMatchFactoryMap.get(key);2180 final var factory = simpleMatchFactoryMap.get(key); 2182 2181 if (factory != null) 2183 2182 return factory.get(key, caseSensitive, regexSearch, tokenizer); 2184 2183 2185 UnaryMatchFactoryunaryFactory = unaryMatchFactoryMap.get(key);2184 final var unaryFactory = unaryMatchFactoryMap.get(key); 2186 2185 if (unaryFactory != null) 2187 2186 return getValidate(unaryFactory, key, tokenizer); … … 2196 2195 return new BooleanMatch(key, false); 2197 2196 else { 2198 SimpleMatchFactoryfactory = simpleMatchFactoryMap.get(key);2197 final var factory = simpleMatchFactoryMap.get(key); 2199 2198 if (factory != null) 2200 2199 return factory.get(key, caseSensitive, regexSearch, null).validate(); 2201 2200 2202 UnaryMatchFactoryunaryFactory = unaryMatchFactoryMap.get(key);2201 final var unaryFactory = unaryMatchFactoryMap.get(key); 2203 2202 if (unaryFactory != null) 2204 2203 return getValidate(unaryFactory, key, null); … … 2222 2221 2223 2222 private static int regexFlags(boolean caseSensitive) { 2224 intsearchFlags = 0;2223 var searchFlags = 0; 2225 2224 2226 2225 // Enables canonical Unicode equivalence so that e.g. the two
Note:
See TracChangeset
for help on using the changeset viewer.