Changeset 30919 in osm


Ignore:
Timestamp:
2015-01-23T00:54:55+01:00 (10 years ago)
Author:
donvip
Message:

[josm_opendata] utilities methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchAdministrativeUnit.java

    r30723 r30919  
    164164        new FrenchRegion("05", "Mayotte")
    165165    };
     166
     167    private static <T extends FrenchAdministrativeUnit> T getUnitFor(String code, T[]units) {
     168        for (T u : units) {
     169            if (u.getCode().equals(code)) {
     170                return u;
     171            }
     172        }
     173        return null;
     174    }
     175
     176    public static FrenchDepartment getDepartmentFor(String dptCode) {
     177        return getUnitFor(dptCode, allDepartments);
     178    }
     179   
     180    public static FrenchRegion getRegionFor(String regCode) {
     181        return getUnitFor(regCode, allRegions);
     182    }
    166183}
Note: See TracChangeset for help on using the changeset viewer.