Changeset 32902 in osm for applications/editors


Ignore:
Timestamp:
2016-09-03T11:37:33+02:00 (8 years ago)
Author:
donvip
Message:

fix error-prone error and warnings

Location:
applications/editors/josm/plugins/public_transport/src/public_transport
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/public_transport/src/public_transport/AbstractImporterDialog.java

    r32357 r32902  
    139139
    140140    public static double parseTime(String s) {
    141         if ((s.charAt(2) != ':') || (s.charAt(2) != ':') || (s.length() < 8))
     141        if ((s.charAt(2) != ':') || (s.charAt(5) != ':') || (s.length() < 8))
    142142            return -1;
    143143        int hour = Integer.parseInt(s.substring(0, 2));
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSAddCommand.java

    r32357 r32902  
    3434        } else {
    3535            for (int i = 0; i < gtfsStopTM.getRowCount(); ++i)
    36                 consideredLines.add(new Integer(i));
     36                consideredLines.add(Integer.valueOf(i));
    3737        }
    3838
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSDeleteCommand.java

    r32357 r32902  
    3434        } else {
    3535            for (int i = 0; i < gtfsStopTM.getRowCount(); ++i)
    36                 consideredLines.add(new Integer(i));
     36                consideredLines.add(Integer.valueOf(i));
    3737        }
    3838
  • applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterAction.java

    r32357 r32902  
    77import java.io.File;
    88import java.io.FileNotFoundException;
    9 import java.io.FileReader;
    109import java.io.IOException;
     10import java.nio.charset.StandardCharsets;
     11import java.nio.file.Files;
    1112import java.text.DecimalFormat;
    1213import java.text.Format;
     
    148149
    149150    private void importData(final File file) {
    150         try {
    151             FileReader is = new FileReader(file);
    152             final BufferedReader r = new BufferedReader(is);
    153 
     151        try (BufferedReader r = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) {
    154152            if (data == null)
    155153                data = new Vector<>();
     
    260258        } else {
    261259            for (int i = 0; i < table.getRowCount(); ++i)
    262                 consideredLines.add(new Integer(i));
     260                consideredLines.add(Integer.valueOf(i));
    263261        }
    264262        return consideredLines;
  • applications/editors/josm/plugins/public_transport/src/public_transport/ItineraryTableModel.java

    r32357 r32902  
    5757            buf[0] = curName;
    5858        else
    59             buf[0] = tr("[ID] {0}", (new Long(way.getId())).toString());
     59            buf[0] = tr("[ID] {0}", (Long.valueOf(way.getId())).toString());
    6060        buf[1] = role;
    6161        if (insPos == -1) {
  • applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportAStar.java

    r32357 r32902  
    22
    33import java.util.Iterator;
     4import java.util.Objects;
    45import java.util.TreeMap;
    56import java.util.TreeSet;
     
    3031                return false;
    3132            return node.equals(((NodeVertex) o).node);
     33        }
     34       
     35        @Override
     36        public int hashCode() {
     37            return Objects.hashCode(node);
    3238        }
    3339
  • applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java

    r32357 r32902  
    5757    public static int STOPLIST_ROLE_COLUMN = 2;
    5858
    59     private class RoutesLSL implements ListSelectionListener {
     59    private static class RoutesLSL implements ListSelectionListener {
    6060        RoutePatternAction root = null;
    6161
     
    7070    }
    7171
    72     private class RouteReference implements Comparable<RouteReference> {
     72    private static class RouteReference implements Comparable<RouteReference> {
    7373        Relation route;
    7474
     
    141141    }
    142142
    143     private class TagTableModel extends DefaultTableModel implements TableModelListener {
     143    private static class TagTableModel extends DefaultTableModel implements TableModelListener {
    144144        Relation relation = null;
    145145
     
    216216    }
    217217
    218     private class CustomCellEditorTable extends JTable {
     218    private static class CustomCellEditorTable extends JTable {
    219219        TreeMap<Integer, TableCellEditor> col1 = null;
    220220
     
    230230            TableCellEditor editor = null;
    231231            if (column == 0)
    232                 editor = col1.get(new Integer(row));
     232                editor = col1.get(Integer.valueOf(row));
    233233            else
    234                 editor = col2.get(new Integer(row));
     234                editor = col2.get(Integer.valueOf(row));
    235235            if (editor == null)
    236236                return new DefaultCellEditor(new JTextField());
     
    241241        public void setCellEditor(int row, int column, TableCellEditor editor) {
    242242            if (column == 0)
    243                 col1.put(new Integer(row), editor);
     243                col1.put(Integer.valueOf(row), editor);
    244244            else
    245                 col2.put(new Integer(row), editor);
     245                col2.put(Integer.valueOf(row), editor);
    246246        }
    247247    }
    248248
    249     private class StoplistTableModel extends DefaultTableModel {
     249    private static class StoplistTableModel extends DefaultTableModel {
    250250
    251251        public Vector<Node> nodes = new Vector<>();
     
    278278                buf[0] = curName;
    279279            } else {
    280                 buf[0] = tr("[ID] {0}", (new Long(node.getId())).toString());
     280                buf[0] = tr("[ID] {0}", (Long.valueOf(node.getId())).toString());
    281281            }
    282282            String curRef = node.get("ref");
     
    311311    }
    312312
    313     private class SegmentMetric {
     313    private static class SegmentMetric {
    314314        public double aLat, aLon;
    315315
     
    347347    }
    348348
    349     private class StopReference implements Comparable<StopReference> {
     349    private static class StopReference implements Comparable<StopReference> {
    350350        public int index = 0;
    351351
  • applications/editors/josm/plugins/public_transport/src/public_transport/SettingsStoptypeCommand.java

    r32357 r32902  
    1313
    1414public class SettingsStoptypeCommand extends Command {
    15     private class HighwayRailway {
     15    private static class HighwayRailway {
    1616        public HighwayRailway(Node node) {
    1717            this.node = node;
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java

    r32357 r32902  
    281281        } else {
    282282            for (int i = 0; i < table.getRowCount(); ++i)
    283                 consideredLines.add(new Integer(i));
     283                consideredLines.add(Integer.valueOf(i));
    284284        }
    285285        return consideredLines;
     
    392392    }
    393393
    394     private class FocusWaypointNameAction extends AbstractAction {
     394    private static class FocusWaypointNameAction extends AbstractAction {
    395395        @Override
    396396        public void actionPerformed(ActionEvent e) {
     
    412412    }
    413413
    414     private class FocusWaypointShelterAction extends AbstractAction {
     414    private static class FocusWaypointShelterAction extends AbstractAction {
    415415        private String defaultShelter = null;
    416416
     
    438438    }
    439439
    440     private class FocusTrackStoplistNameAction extends AbstractAction {
     440    private static class FocusTrackStoplistNameAction extends AbstractAction {
    441441        @Override
    442442        public void actionPerformed(ActionEvent e) {
     
    458458    }
    459459
    460     private class FocusTrackStoplistShelterAction extends AbstractAction {
     460    private static class FocusTrackStoplistShelterAction extends AbstractAction {
    461461        private String defaultShelter = null;
    462462
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java

    r32357 r32902  
    1212
    1313public class TrackStoplistDeleteCommand extends Command {
    14     private class NodeTimeName {
     14    private static class NodeTimeName {
    1515        NodeTimeName(Node node, String time, String name, TransText shelter) {
    1616            this.node = node;
     
    4848        } else {
    4949            for (int i = 0; i < stoplistTM.getRowCount(); ++i)
    50                 workingLines.add(new Integer(i));
     50                workingLines.add(Integer.valueOf(i));
    5151        }
    5252    }
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDetachCommand.java

    r32357 r32902  
    3030        } else {
    3131            for (int i = 0; i < stoplistTM.getRowCount(); ++i)
    32                 consideredLines.add(new Integer(i));
     32                consideredLines.add(Integer.valueOf(i));
    3333        }
    3434
  • applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java

    r32357 r32902  
    4040        } else {
    4141            for (int i = 0; i < stoplistTM.getRowCount(); ++i)
    42                 workingLines.add(new Integer(i));
     42                workingLines.add(Integer.valueOf(i));
    4343        }
    4444    }
     
    9191    }
    9292
    93     private class NodeSortEntry implements Comparable<NodeSortEntry> {
     93    private static class NodeSortEntry implements Comparable<NodeSortEntry> {
    9494        public Node node = null;
    9595
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDetachCommand.java

    r32357 r32902  
    3030        } else {
    3131            for (int i = 0; i < waypointTM.getRowCount(); ++i)
    32                 consideredLines.add(new Integer(i));
     32                consideredLines.add(Integer.valueOf(i));
    3333        }
    3434
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDisableCommand.java

    r32357 r32902  
    3131        } else {
    3232            for (int i = 0; i < waypointTM.getRowCount(); ++i)
    33                 consideredLines.add(new Integer(i));
     33                consideredLines.add(Integer.valueOf(i));
    3434        }
    3535
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsEnableCommand.java

    r32357 r32902  
    3131        } else {
    3232            for (int i = 0; i < waypointTM.getRowCount(); ++i)
    33                 consideredLines.add(new Integer(i));
     33                consideredLines.add(Integer.valueOf(i));
    3434        }
    3535
Note: See TracChangeset for help on using the changeset viewer.