Ignore:
Timestamp:
2014-04-27T15:35:47+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - use String switch/case where applicable

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r7005 r7012  
    9898            switch (states.peek()) {
    9999            case INIT:
    100                 if (qName.equals("imagery")) {
     100                if ("imagery".equals(qName)) {
    101101                    newState = State.IMAGERY;
    102102                }
    103103                break;
    104104            case IMAGERY:
    105                 if (qName.equals("entry")) {
     105                if ("entry".equals(qName)) {
    106106                    entry = new ImageryInfo();
    107107                    skipEntry = false;
     
    128128                }).contains(qName)) {
    129129                    newState = State.ENTRY_ATTRIBUTE;
    130                 } else if (qName.equals("bounds")) {
     130                } else if ("bounds".equals(qName)) {
    131131                    try {
    132132                        bounds = new ImageryBounds(
     
    139139                    }
    140140                    newState = State.BOUNDS;
    141                 } else if (qName.equals("projections")) {
     141                } else if ("projections".equals(qName)) {
    142142                    projections = new ArrayList<>();
    143143                    newState = State.PROJECTIONS;
     
    145145                break;
    146146            case BOUNDS:
    147                 if (qName.equals("shape")) {
     147                if ("shape".equals(qName)) {
    148148                    shape = new Shape();
    149149                    newState = State.SHAPE;
     
    151151                break;
    152152            case SHAPE:
    153                 if (qName.equals("point")) {
     153                if ("point".equals(qName)) {
    154154                    try {
    155155                        shape.addPoint(atts.getValue("lat"), atts.getValue("lon"));
     
    160160                break;
    161161            case PROJECTIONS:
    162                 if (qName.equals("code")) {
     162                if ("code".equals(qName)) {
    163163                    newState = State.CODE;
    164164                }
     
    192192                throw new RuntimeException("parsing error: more closing than opening elements");
    193193            case ENTRY:
    194                 if (qName.equals("entry")) {
     194                if ("entry".equals(qName)) {
    195195                    if (!skipEntry) {
    196196                        entries.add(entry);
     
    200200                break;
    201201            case ENTRY_ATTRIBUTE:
    202                 if (qName.equals("name")) {
     202                switch(qName) {
     203                case "name":
    203204                    entry.setTranslatedName(accumulator.toString());
    204                 } else if (qName.equals("type")) {
     205                    break;
     206                case "type":
    205207                    boolean found = false;
    206208                    for (ImageryType type : ImageryType.values()) {
     
    214216                        skipEntry = true;
    215217                    }
    216                 } else if (qName.equals("default")) {
    217                     if (accumulator.toString().equals("true")) {
     218                    break;
     219                case "default":
     220                    switch (accumulator.toString()) {
     221                    case "true":
    218222                        entry.setDefaultEntry(true);
    219                     } else if (accumulator.toString().equals("false")) {
     223                        break;
     224                    case "false":
    220225                        entry.setDefaultEntry(false);
    221                     } else {
     226                        break;
     227                    default:
    222228                        skipEntry = true;
    223229                    }
    224                 } else if (qName.equals("url")) {
     230                    break;
     231                case "url":
    225232                    entry.setUrl(accumulator.toString());
    226                 } else if (qName.equals("eula")) {
     233                    break;
     234                case "eula":
    227235                    entry.setEulaAcceptanceRequired(accumulator.toString());
    228                 } else if (qName.equals("min-zoom") || qName.equals("max-zoom")) {
     236                    break;
     237                case "min-zoom":
     238                case "max-zoom":
    229239                    Integer val = null;
    230240                    try {
     
    236246                        skipEntry = true;
    237247                    } else {
    238                         if (qName.equals("min-zoom")) {
     248                        if ("min-zoom".equals(qName)) {
    239249                            entry.setDefaultMinZoom(val);
    240250                        } else {
     
    242252                        }
    243253                    }
    244                 } else if (qName.equals("attribution-text")) {
     254                    break;
     255                case "attribution-text":
    245256                    entry.setAttributionText(accumulator.toString());
    246                 } else if (qName.equals("attribution-url")) {
     257                    break;
     258                case "attribution-url":
    247259                    entry.setAttributionLinkURL(accumulator.toString());
    248                 } else if (qName.equals("logo-image")) {
     260                    break;
     261                case "logo-image":
    249262                    entry.setAttributionImage(accumulator.toString());
    250                 } else if (qName.equals("logo-url")) {
     263                    break;
     264                case "logo-url":
    251265                    entry.setAttributionImageURL(accumulator.toString());
    252                 } else if (qName.equals("terms-of-use-text")) {
     266                    break;
     267                case "terms-of-use-text":
    253268                    entry.setTermsOfUseText(accumulator.toString());
    254                 } else if (qName.equals("terms-of-use-url")) {
     269                    break;
     270                case "terms-of-use-url":
    255271                    entry.setTermsOfUseURL(accumulator.toString());
    256                 } else if (qName.equals("country-code")) {
     272                    break;
     273                case "country-code":
    257274                    entry.setCountryCode(accumulator.toString());
    258                 } else if (qName.equals("icon")) {
     275                    break;
     276                case "icon":
    259277                    entry.setIcon(accumulator.toString());
     278                    break;
    260279                }
    261280                break;
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java

    r7005 r7012  
    9292            e = ne.lon();
    9393        }
    94         if (myProj.equals("EPSG:4326") && !info.getServerProjections().contains(myProj) && info.getServerProjections().contains("CRS:84")) {
     94        if ("EPSG:4326".equals(myProj) && !info.getServerProjections().contains(myProj) && info.getServerProjections().contains("CRS:84")) {
    9595            myProj = "CRS:84";
    9696        }
     
    114114        if (baseURL.toLowerCase().contains("crs=epsg:4326")) {
    115115            switchLatLon = true;
    116         } else if (baseURL.toLowerCase().contains("crs=") && myProj.equals("EPSG:4326")) {
     116        } else if (baseURL.toLowerCase().contains("crs=") && "EPSG:4326".equals(myProj)) {
    117117            switchLatLon = true;
    118118        }
Note: See TracChangeset for help on using the changeset viewer.