src/main/java/de/blau/android/osm/StorageDelegator.java
/**
     * Check if a relation has from, via and to members, that is, is similar to a restriction relation
     * 
     * Does one sequential scan of all members
     * 
     * @param r the Relation
     * @return true if all three roles are present
     */
Check if a relation has from, via and to members, that is, is similar to a restriction relation

Does one sequential scan of all members

@param r the Relation
@return true if all three roles are present
Check if a relation has from via and to members that is is similar to a restriction relation Does one sequential scan of all members @param r the Relation @return true if all three roles are present
private boolean hasFromViaTo(@NonNull Relation r) {
        List<RelationMember> members = r.getMembers();
        boolean hasFrom = false;
        boolean hasVia = false;
        boolean hasTo = false;
        for (RelationMember rm : members) {
            String role = rm.getRole();
            if (role != null) {
                switch (role) {
                case Tags.ROLE_FROM:
                    hasFrom = true;
                    break;
                case Tags.ROLE_INTERSECTION:
                case Tags.ROLE_VIA:
                    hasVia = true;
                    break;
                case Tags.ROLE_TO:
                    hasTo = true;
                    break;
                default: 
                }
            }
        }
        return hasFrom && hasVia && hasTo;
    }
private boolean hasFromViaTo ( @ NonNull Relation r ) { List < RelationMember > members = r . getMembers ( ) ; boolean hasFrom = false ; boolean hasVia = false ; boolean hasTo = false ; for ( RelationMember rm : members ) { String role = rm . getRole ( ) ; if ( role != null ) { switch ( role ) { case Tags . ROLE_FROM : hasFrom = true ; break ; case Tags . ROLE_INTERSECTION : case Tags . ROLE_VIA : hasVia = true ; break ; case Tags . ROLE_TO : hasTo = true ; break ; default : } } } return hasFrom && hasVia && hasTo ; }
Check if a relation has from, via and to members, that is, is similar to a restriction relation
Check if a relation has from via and to members that is is similar to a restriction relation
// do nothing