Ignore:
Timestamp:
2020-03-01T23:36:09+01:00 (4 years ago)
Author:
simon04
Message:

see #18802 - MapCSSStyleIndex: rename/move

File:
1 edited

Legend:

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

    r15988 r15989  
    5050import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction;
    5151import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule;
     52import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleIndex;
    5253import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    5354import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
     
    7374 */
    7475public class MapCSSTagChecker extends Test.TagTest {
    75     private MapCSSTagCheckerIndex indexData;
     76    private MapCSSStyleIndex indexData;
    7677    final Map<MapCSSRule, MapCSSTagCheckerAndRule> ruleToCheckMap = new HashMap<>();
    7778    private final Set<OsmPrimitive> tested = new HashSet<>();
    7879    private static final Map<IPrimitive, Area> mpAreaCache = new HashMap<>();
     80    static final boolean ALL_TESTS = true;
     81    static final boolean ONLY_SELECTED_TESTS = false;
    7982
    8083    /**
     
    622625    }
    623626
    624     static MapCSSTagCheckerIndex createMapCSSTagCheckerIndex(MultiMap<String, TagCheck> checks, boolean includeOtherSeverity, boolean allTests) {
    625         final MapCSSTagCheckerIndex index = new MapCSSTagCheckerIndex();
     627    private static boolean hasSameDeclaration(MapCSSRule rule1, final MapCSSRule rule2) {
     628        return Objects.equals(rule1.declaration, rule2.declaration);
     629    }
     630
     631    static MapCSSStyleIndex createMapCSSTagCheckerIndex(MultiMap<String, TagCheck> checks, boolean includeOtherSeverity, boolean allTests) {
     632        final MapCSSStyleIndex index = new MapCSSStyleIndex();
    626633        final Stream<MapCSSRule> ruleStream = checks.values().stream()
    627634                .flatMap(Collection::stream)
     
    643650        final List<TestError> res = new ArrayList<>();
    644651        if (indexData == null) {
    645             indexData = MapCSSTagCheckerIndex.createMapCSSTagCheckerIndex(checks, includeOtherSeverity, MapCSSTagCheckerIndex.ALL_TESTS);
     652            indexData = createMapCSSTagCheckerIndex(checks, includeOtherSeverity, ALL_TESTS);
    646653        }
    647654
     
    850857        super.setShowElements(true);
    851858        if (indexData == null) {
    852             indexData = MapCSSTagCheckerIndex.createMapCSSTagCheckerIndex(checks, includeOtherSeverityChecks(), MapCSSTagCheckerIndex.ALL_TESTS);
     859            indexData = createMapCSSTagCheckerIndex(checks, includeOtherSeverityChecks(), ALL_TESTS);
    853860        }
    854861        tested.clear();
     
    864871            // rebuild index with a reduced set of rules (those that use ChildOrParentSelector) and thus may have left selectors
    865872            // matching the previously tested elements
    866             indexData = MapCSSTagCheckerIndex.createMapCSSTagCheckerIndex(checks, includeOtherSeverityChecks(), MapCSSTagCheckerIndex.ONLY_SELECTED_TESTS);
     873            indexData = createMapCSSTagCheckerIndex(checks, includeOtherSeverityChecks(), ONLY_SELECTED_TESTS);
    867874
    868875            Set<OsmPrimitive> surrounding = new HashSet<>();
Note: See TracChangeset for help on using the changeset viewer.