Ignore:
Timestamp:
2012-11-18T16:40:44+01:00 (11 years ago)
Author:
bastiK
Message:

suppress some warnings (unchecked cast mostly)

Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r5258 r5590  
    10281028        engine.eval(finish);
    10291029
     1030        @SuppressWarnings("unchecked")
    10301031        Map<String, String> stringMap =  (Map<String, String>) engine.get("stringMap");
     1032        @SuppressWarnings("unchecked")
    10311033        Map<String, List<String>> listMap = (SortedMap<String, List<String>> ) engine.get("listMap");
     1034        @SuppressWarnings("unchecked")
    10321035        Map<String, List<Collection<String>>> listlistMap = (SortedMap<String, List<Collection<String>>>) engine.get("listlistMap");
     1036        @SuppressWarnings("unchecked")
    10331037        Map<String, List<Map<String, String>>> listmapMap = (SortedMap<String, List<Map<String,String>>>) engine.get("listmapMap");
    10341038
     
    10501054        for (Entry<String, List<Collection<String>>> e : listlistMap.entrySet()) {
    10511055            if (Preferences.equalArray(e.getValue(), tmpPref.arrayDefaults.get(e.getKey()))) continue;
    1052             tmpPref.arrayProperties.put(e.getKey(), (List<List<String>>)(List)e.getValue());
     1056            @SuppressWarnings("unchecked") List<List<String>> value = (List)e.getValue();
     1057            tmpPref.arrayProperties.put(e.getKey(), value);
    10531058        }
    10541059
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r5467 r5590  
    17991799        if (a instanceof StringSetting)
    18001800            return (a.getValue().equals(b.getValue()));
    1801         if (a instanceof ListSetting)
    1802             return equalCollection((Collection<String>) a.getValue(), (Collection<String>) b.getValue());
    1803         if (a instanceof ListListSetting)
    1804             return equalArray((Collection<Collection<String>>) a.getValue(), (Collection<List<String>>) b.getValue());
    1805         if (a instanceof MapListSetting)
    1806             return equalListOfStructs((Collection<Map<String, String>>) a.getValue(), (Collection<Map<String, String>>) b.getValue());
     1801        if (a instanceof ListSetting) {
     1802            @SuppressWarnings("unchecked") Collection<String> aValue = (Collection) a.getValue();
     1803            @SuppressWarnings("unchecked") Collection<String> bValue = (Collection) b.getValue();
     1804            return equalCollection(aValue, bValue);
     1805        }
     1806        if (a instanceof ListListSetting) {
     1807            @SuppressWarnings("unchecked") Collection<Collection<String>> aValue = (Collection) a.getValue();
     1808            @SuppressWarnings("unchecked") Collection<List<String>> bValue = (Collection) b.getValue();
     1809            return equalArray(aValue, bValue);
     1810        }
     1811        if (a instanceof MapListSetting) {
     1812            @SuppressWarnings("unchecked") Collection<Map<String, String>> aValue = (Collection) a.getValue();
     1813            @SuppressWarnings("unchecked") Collection<Map<String, String>> bValue = (Collection) b.getValue();
     1814            return equalListOfStructs(aValue, bValue);
     1815        }
    18071816        return a.equals(b);
    18081817    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r5571 r5590  
    2424import java.awt.geom.Rectangle2D;
    2525import java.util.ArrayList;
    26 import java.util.Arrays;
    2726import java.util.Collection;
    2827import java.util.Collections;
     
    6160import org.openstreetmap.josm.gui.mappaint.TextElement;
    6261import org.openstreetmap.josm.tools.ImageProvider;
    63 import org.openstreetmap.josm.tools.Pair;
    6462import org.openstreetmap.josm.tools.Utils;
    6563
     
    11941192
    11951193                            while (dist < segmentLength) {
    1196                                 for (Pair<Float, GeneralPath> sizeAndPath : Arrays.asList(new Pair[] {
    1197                                         new Pair<Float, GeneralPath>(3f, onewayArrowsCasing),
    1198                                         new Pair<Float, GeneralPath>(2f, onewayArrows)})) {
     1194                                for (int i=0; i<2; ++i) {
     1195                                    float onewaySize = i == 0 ? 3f : 2f;
     1196                                    GeneralPath onewayPath = i == 0 ? onewayArrowsCasing : onewayArrows;
    11991197
    12001198                                    // scale such that border is 1 px
    1201                                     final double fac = - (onewayReversed ? -1 : 1) * sizeAndPath.a * (1 + sinPHI) / (sinPHI * cosPHI);
     1199                                    final double fac = - (onewayReversed ? -1 : 1) * onewaySize * (1 + sinPHI) / (sinPHI * cosPHI);
    12021200                                    final double sx = nx * fac;
    12031201                                    final double sy = ny * fac;
     
    12051203                                    // Attach the triangle at the incenter and not at the tip.
    12061204                                    // Makes the border even at all sides.
    1207                                     final double x = p1.x + nx * (dist + (onewayReversed ? -1 : 1) * (sizeAndPath.a / sinPHI));
    1208                                     final double y = p1.y + ny * (dist + (onewayReversed ? -1 : 1) * (sizeAndPath.a / sinPHI));
    1209 
    1210                                     sizeAndPath.b.moveTo(x, y);
    1211                                     sizeAndPath.b.lineTo (x + cosPHI * sx - sinPHI * sy, y + sinPHI * sx + cosPHI * sy);
    1212                                     sizeAndPath.b.lineTo (x + cosPHI * sx + sinPHI * sy, y - sinPHI * sx + cosPHI * sy);
    1213                                     sizeAndPath.b.lineTo(x, y);
     1205                                    final double x = p1.x + nx * (dist + (onewayReversed ? -1 : 1) * (onewaySize / sinPHI));
     1206                                    final double y = p1.y + ny * (dist + (onewayReversed ? -1 : 1) * (onewaySize / sinPHI));
     1207
     1208                                    onewayPath.moveTo(x, y);
     1209                                    onewayPath.lineTo (x + cosPHI * sx - sinPHI * sy, y + sinPHI * sx + cosPHI * sy);
     1210                                    onewayPath.lineTo (x + cosPHI * sx + sinPHI * sy, y - sinPHI * sx + cosPHI * sy);
     1211                                    onewayPath.lineTo(x, y);
    12141212                                }
    12151213                                dist += interval;
Note: See TracChangeset for help on using the changeset viewer.