Changeset 7879 in josm for trunk/src


Ignore:
Timestamp:
2014-12-24T02:41:51+01:00 (10 years ago)
Author:
Don-vip
Message:

optimize / ease debug the chek of assertions in MapCSSTagChecker

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r7796 r7879  
    117117                return false;
    118118            return true;
     119        }
     120
     121        @Override
     122        public String toString() {
     123            return "GroupedMapCSSRule [selectors=" + selectors + ", declaration=" + declaration + "]";
    119124        }
    120125    }
     
    525530            return result;
    526531        }
     532
     533        @Override
     534        public String toString() {
     535            return "MapCSSTagCheckerAndRule [rule=" + rule + "]";
     536        }
    527537    }
    528538
     
    534544     */
    535545    public synchronized Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity) {
     546        return getErrorsForPrimitive(p, includeOtherSeverity, checks.values());
     547    }
     548
     549    private static Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity,
     550            Collection<Set<TagCheck>> checksCol) {
    536551        final List<TestError> r = new ArrayList<>();
    537552        final Environment env = new Environment(p, new MultiCascade(), Environment.DEFAULT_LAYER, null);
    538         for (Set<TagCheck> schecks : checks.values()) {
     553        for (Set<TagCheck> schecks : checksCol) {
    539554            for (TagCheck check : schecks) {
    540555                if (Severity.OTHER.equals(check.getSeverity()) && !includeOtherSeverity) {
     
    641656                // Add primitive to dataset to avoid DataIntegrityProblemException when evaluating selectors
    642657                ds.addPrimitive(p);
    643                 final boolean isError = Utils.exists(getErrorsForPrimitive(p, true), new Predicate<TestError>() {
     658                final Collection<TestError> pErrors = getErrorsForPrimitive(p, true,
     659                        Collections.singleton(Collections.singleton(check)));
     660                if (Main.isDebugEnabled()) {
     661                    Main.debug("- Errors: "+pErrors);
     662                }
     663                final boolean isError = Utils.exists(pErrors, new Predicate<TestError>() {
    644664                    @Override
    645665                    public boolean evaluate(TestError e) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java

    r7140 r7879  
    6767            return true;
    6868        }
     69
     70        @Override
     71        public String toString() {
     72            return "Declaration [instructions=" + instructions + ", idx=" + idx + "]";
     73        }
    6974    }
    7075
     76    /**
     77     * Constructs a new {@code MapCSSRule}.
     78     * @param selector The selector
     79     * @param declaration The declaration
     80     */
    7181    public MapCSSRule(Selector selector, Declaration declaration) {
    7282        this.selector = selector;
Note: See TracChangeset for help on using the changeset viewer.