src/main/java/de/blau/android/validation/BaseValidator.java
/**
     * Return a List of Strings describing the problems detected in calcProblem
     * 
     * @param ctx Android Context
     * @param e OsmElement
     * @param tags the associates tags
     * @param pi a matching PrestItem or null
     * @return a List of Strings describing the problems
     */
Return a List of Strings describing the problems detected in calcProblem


Return a List of Strings describing the problems detected in calcProblem
@NonNull
    private List<String> describeProblemElement(@NonNull Context ctx, @NonNull OsmElement e, @NonNull SortedMap<String, String> tags, @Nullable PresetItem pi) {
        List<String> result = new ArrayList<>();
        int cachedProblems = e.getCachedProblems();
        if ((cachedProblems & Validator.INVALID_OBJECT) != 0) {
            result.add(ctx.getString(R.string.toast_invalid_object));
        }
        if ((cachedProblems & Validator.UNTAGGED) != 0) {
            result.add(ctx.getString(R.string.toast_untagged_element));
        }
        for (Entry<String, String> entry : tags.entrySet()) {
            if (FIXME_PATTERN.matcher(entry.getKey()).matches() || FIXME_PATTERN.matcher(entry.getValue()).matches()) {
                result.add(entry.getKey() + ": " + entry.getValue());
            }
        }
        if ((cachedProblems & Validator.AGE) != 0) {
            result.add(ctx.getString(R.string.toast_needs_resurvey));
        }
        if (pi != null && checkTags != null) {
            for (Entry<String, Boolean> entry : checkTags.entrySet()) {
                String[] keys = splitKeys(entry);
                for (String key : keys) {
                    key = key.trim();
                    if (pi.hasKey(key, entry.getValue()) && !e.hasTagKey(key) && reportMissingKey(e, key)) {
                        String hint = pi.getHint(key);
                        result.add(ctx.getString(R.string.toast_missing_key, hint != null ? hint : key));
                    }
                }
            }
        }
        if (pi != null) {
            List<ElementType> elementType = pi.appliesTo();
            final ElementType type = e.getType();
            if (!elementType.contains(type)) {
                result.add(ctx.getString(R.string.toast_wrong_element_type, ctx.getString(ELEMENT_TYPE_NAMES.get(type))));
            }
        }
        return result;
    }
@ NonNull private List < String > describeProblemElement ( @ NonNull Context ctx , @ NonNull OsmElement e , @ NonNull SortedMap < String , String > tags , @ Nullable PresetItem pi ) { List < String > result = new ArrayList < > ( ) ; int cachedProblems = e . getCachedProblems ( ) ; if ( ( cachedProblems & Validator . INVALID_OBJECT ) != 0 ) { result . add ( ctx . getString ( R . string . toast_invalid_object ) ) ; } if ( ( cachedProblems & Validator . UNTAGGED ) != 0 ) { result . add ( ctx . getString ( R . string . toast_untagged_element ) ) ; } for ( Entry < String , String > entry : tags . entrySet ( ) ) { if ( FIXME_PATTERN . matcher ( entry . getKey ( ) ) . matches ( ) || FIXME_PATTERN . matcher ( entry . getValue ( ) ) . matches ( ) ) { result . add ( entry . getKey ( ) + ": " + entry . getValue ( ) ) ; } } if ( ( cachedProblems & Validator . AGE ) != 0 ) { result . add ( ctx . getString ( R . string . toast_needs_resurvey ) ) ; } if ( pi != null && checkTags != null ) { for ( Entry < String , Boolean > entry : checkTags . entrySet ( ) ) { String [ ] keys = splitKeys ( entry ) ; for ( String key : keys ) { key = key . trim ( ) ; if ( pi . hasKey ( key , entry . getValue ( ) ) && ! e . hasTagKey ( key ) && reportMissingKey ( e , key ) ) { String hint = pi . getHint ( key ) ; result . add ( ctx . getString ( R . string . toast_missing_key , hint != null ? hint : key ) ) ; } } } } if ( pi != null ) { List < ElementType > elementType = pi . appliesTo ( ) ; final ElementType type = e . getType ( ) ; if ( ! elementType . contains ( type ) ) { result . add ( ctx . getString ( R . string . toast_wrong_element_type , ctx . getString ( ELEMENT_TYPE_NAMES . get ( type ) ) ) ) ; } } return result ; }
Return a List of Strings describing the problems detected in calcProblem
Return a List of Strings describing the problems detected in calcProblem
// invalid OSM element // fixme etc. // NOSONAR // test key and value against pattern // resurvey age // missing tags // wrong element type