src/main/java/de/blau/android/validation/ExtendedValidator.java
/**
     * Recursively try to determine if the relation has a loop
     * 
     * @param members the current relation members
     * @param map a Map for bookkeeping
     * @return true if the relation has a loop
     */
Recursively try to determine if the relation has a loop

@param members the current relation members
@param map a Map for bookkeeping
@return true if the relation has a loop
Recursively try to determine if the relation has a loop @param members the current relation members @param map a Map for bookkeeping @return true if the relation has a loop
private boolean hasLoop(@Nullable List<RelationMember> members, @NonNull LongOsmElementMap<Relation> map) {
        if (members != null) {
            for (RelationMember member : members) {
                if (member.downloaded() && Relation.NAME.equals(member.getType())) {
                    if (map.containsKey(member.getRef())) {
                        return true;
                    }
                    Relation relation = (Relation) member.getElement();
                    map.put(member.getRef(), relation);
                    return hasLoop(relation.getMembers(), map);
                }
            }
        }
        return false;
    }
private boolean hasLoop ( @ Nullable List < RelationMember > members , @ NonNull LongOsmElementMap < Relation > map ) { if ( members != null ) { for ( RelationMember member : members ) { if ( member . downloaded ( ) && Relation . NAME . equals ( member . getType ( ) ) ) { if ( map . containsKey ( member . getRef ( ) ) ) { return true ; } Relation relation = ( Relation ) member . getElement ( ) ; map . put ( member . getRef ( ) , relation ) ; return hasLoop ( relation . getMembers ( ) , map ) ; } } } return false ; }
Recursively try to determine if the relation has a loop
Recursively try to determine if the relation has a loop