Changeset 10043 in josm


Ignore:
Timestamp:
2016-03-26T14:45:25+01:00 (9 years ago)
Author:
Don-vip
Message:

sonar - squid:S2325 - "private" methods that don't access instance data should be "static"

Location:
trunk/src/org/openstreetmap/josm
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/CopyCoordinatesAction.java

    r8390 r10043  
    4747    }
    4848
    49     private Collection<Node> getSelectedNodes() {
     49    private static Collection<Node> getSelectedNodes() {
    5050        if (getCurrentDataSet() == null || getCurrentDataSet().getSelected() == null) {
    5151            return Collections.emptyList();
  • trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java

    r9968 r10043  
    6969     * @return Array of number of nodes to put in each arc
    7070     */
    71     private int[] distributeNodes(PolarNode[] angles, int nodesCount) {
     71    private static int[] distributeNodes(PolarNode[] angles, int nodesCount) {
    7272        int[] count = new int[angles.length];
    7373        double[] width = new double[angles.length];
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r10001 r10043  
    777777     * @throws IllegalArgumentException if parts is empty
    778778     */
    779     private List<WayInPolygon> markWayInsideSide(List<Way> parts, boolean isInner) {
     779    private static List<WayInPolygon> markWayInsideSide(List<Way> parts, boolean isInner) {
    780780
    781781        //prepare next map
     
    10261026     * @return the outermost Way.
    10271027     */
    1028     private List<PolygonLevel> findOuterWaysImpl(int level, Collection<AssembledPolygon> boundaryWays) {
     1028    private static List<PolygonLevel> findOuterWaysImpl(int level, Collection<AssembledPolygon> boundaryWays) {
    10291029
    10301030        //TODO: bad performance for deep nestings...
     
    12931293     * @return list of polygons, or null if too complex relation encountered.
    12941294     */
    1295     private List<Multipolygon> collectMultipolygons(Collection<Way> selectedWays) {
     1295    private static List<Multipolygon> collectMultipolygons(Collection<Way> selectedWays) {
    12961296
    12971297        List<Multipolygon> result = new ArrayList<>();
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r10001 r10043  
    367367     * @return List of ways to split
    368368     */
    369     private List<Way> getApplicableWays(List<Way> selectedWays, List<Node> selectedNodes) {
     369    private static List<Way> getApplicableWays(List<Way> selectedWays, List<Node> selectedNodes) {
    370370        if (selectedNodes.isEmpty())
    371371            return null;
  • trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java

    r8510 r10043  
    149149     * @return List of relevant ways
    150150     */
    151     private List<Way> getApplicableWays(List<Way> selectedWays, List<Node> selectedNodes) {
     151    private static List<Way> getApplicableWays(List<Way> selectedWays, List<Node> selectedNodes) {
    152152        if (selectedNodes.isEmpty())
    153153            return null;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r9989 r10043  
    869869    }
    870870
    871     private boolean movesHiddenWay() {
     871    private static boolean movesHiddenWay() {
    872872        final Collection<OsmPrimitive> elementsToTest = new HashSet<>(getCurrentDataSet().getSelected());
    873873        for (Way osm : Utils.filteredCollection(getCurrentDataSet().getSelected(), Way.class)) {
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r9586 r10043  
    324324    }
    325325
    326     private boolean jvmPerfDataFileExists(final String jvmId) {
     326    private static boolean jvmPerfDataFileExists(final String jvmId) {
    327327        File jvmDir = new File(System.getProperty("java.io.tmpdir") + File.separator + "hsperfdata_" + System.getProperty("user.name"));
    328328        if (jvmDir.exists() && jvmDir.canRead()) {
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r10000 r10043  
    261261    }
    262262
    263     private Layer userSelectLayer(Collection<Layer> layers) {
     263    private static Layer userSelectLayer(Collection<Layer> layers) {
    264264        if (layers.size() == 1)
    265265            return layers.iterator().next();
  • trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java

    r9371 r10043  
    184184    }
    185185
    186     private void fireEvents(List<ListenerInfo> listeners, AbstractDatasetChangedEvent event) {
     186    private static void fireEvents(List<ListenerInfo> listeners, AbstractDatasetChangedEvent event) {
    187187        for (ListenerInfo listener: listeners) {
    188188            if (!listener.consolidate) {
     
    192192    }
    193193
    194     private void fireConsolidatedEvents(List<ListenerInfo> listeners, AbstractDatasetChangedEvent event) {
     194    private static void fireConsolidatedEvents(List<ListenerInfo> listeners, AbstractDatasetChangedEvent event) {
    195195        for (ListenerInfo listener: listeners) {
    196196            if (listener.consolidate) {
  • trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java

    r9371 r10043  
    8282    }
    8383
    84     private void fireEvents(List<ListenerInfo> listeners, Collection<? extends OsmPrimitive> newSelection) {
     84    private static void fireEvents(List<ListenerInfo> listeners, Collection<? extends OsmPrimitive> newSelection) {
    8585        for (ListenerInfo listener: listeners) {
    8686            listener.listener.selectionChanged(newSelection);
     
    9696        }
    9797    };
    98 
    9998}
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r9886 r10043  
    231231     * @return translated/shortened error/warnign message
    232232     */
    233     private String getErrorMessage(String key, Object o) {
     233    private static String getErrorMessage(String key, Object o) {
    234234        String msg = o.toString().trim()
    235235        .replace("Unexpected token:", tr("Unexpected token:"))
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java

    r9999 r10043  
    6767    }
    6868
    69     private boolean parentMultipolygonConcernsArea(OsmPrimitive p) {
     69    private static boolean parentMultipolygonConcernsArea(OsmPrimitive p) {
    7070        for (Relation r : OsmPrimitive.getFilteredList(p.getReferrers(), Relation.class)) {
    7171            if (r.concernsArea()) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r9932 r10043  
    126126    }
    127127
    128     private Map<String, RoleInfo> buildRoleInfoMap(Relation n) {
     128    private static Map<String, RoleInfo> buildRoleInfoMap(Relation n) {
    129129        Map<String, RoleInfo> map = new HashMap<>();
    130130        for (RelationMember m : n.getMembers()) {
     
    141141
    142142    // return Roles grouped by key
    143     private Map<String, RolePreset> buildAllRoles(Relation n) {
     143    private static Map<String, RolePreset> buildAllRoles(Relation n) {
    144144        Map<String, RolePreset> allroles = new HashMap<>();
    145145
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r9995 r10043  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55import static org.openstreetmap.josm.tools.I18n.trn;
    6 import gnu.getopt.Getopt;
    7 import gnu.getopt.LongOpt;
    86
    97import java.awt.Dimension;
     
    7573import org.openstreetmap.josm.tools.PlatformHookWindows;
    7674import org.openstreetmap.josm.tools.Utils;
     75
     76import gnu.getopt.Getopt;
     77import gnu.getopt.LongOpt;
    7778
    7879/**
     
    651652        }
    652653
    653         private boolean handleNetworkOrProxyErrors(boolean hasErrors, String title, String message) {
     654        private static boolean handleNetworkOrProxyErrors(boolean hasErrors, String title, String message) {
    654655            if (hasErrors) {
    655656                ExtendedDialog ed = new ExtendedDialog(
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r10035 r10043  
    446446    }
    447447
    448     private void destroyComponents(Component component, boolean destroyItself) {
     448    private static void destroyComponents(Component component, boolean destroyItself) {
    449449        if (component instanceof Container) {
    450450            for (Component c: ((Container) component).getComponents()) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRenderer.java

    r9149 r10043  
    3131    private final Collection<TableCellRenderer> customRenderer = new CopyOnWriteArrayList<>();
    3232
    33     private void setColors(Component c, String key, boolean isSelected) {
     33    private static void setColors(Component c, String key, boolean isSelected) {
    3434        UIDefaults defaults = javax.swing.UIManager.getDefaults();
    3535        if (OsmPrimitive.getDiscardableKeys().contains(key)) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r9970 r10043  
    566566    }
    567567
    568     private int findViewRow(JTable table, TableModel model, Object value) {
     568    private static int findViewRow(JTable table, TableModel model, Object value) {
    569569        for (int i = 0; i < model.getRowCount(); i++) {
    570570            if (model.getValueAt(i, 0).equals(value))
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationNodeMap.java

    r9246 r10043  
    280280    }
    281281
    282     private Integer findAdjacentWay(NodesWays nw, Node n) {
     282    private static Integer findAdjacentWay(NodesWays nw, Node n) {
    283283        Set<Integer> adj = nw.nodes.get(n);
    284284        if (adj == null || adj.isEmpty()) return null;
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

    r9078 r10043  
    446446    }
    447447
    448     private void updateWaypointLabelCombobox(JosmComboBox<String> cb, JosmTextField tf, TemplateEntryProperty property) {
     448    private static void updateWaypointLabelCombobox(JosmComboBox<String> cb, JosmTextField tf, TemplateEntryProperty property) {
    449449        String labelPattern = property.getAsString();
    450450        boolean found = false;
     
    463463    }
    464464
    465     private void updateWaypointPattern(JosmComboBox<String> cb, JosmTextField tf) {
     465    private static void updateWaypointPattern(JosmComboBox<String> cb, JosmTextField tf) {
    466466        if (cb.getSelectedIndex() == WAYPOINT_LABEL_CUSTOM) {
    467467            tf.setEnabled(true);
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheContentsPanel.java

    r10021 r10043  
    228228    }
    229229
    230     private JTable getTableForCache(final CacheAccess<String, BufferedImageCacheEntry> cache, final TableModel tableModel) {
     230    private static JTable getTableForCache(final CacheAccess<String, BufferedImageCacheEntry> cache, final TableModel tableModel) {
    231231        final JTable ret = new JTable(tableModel);
    232232
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java

    r10016 r10043  
    771771        }
    772772
    773         private boolean confirmEulaAcceptance(PreferenceTabbedPane gui, String eulaUrl) {
     773        private static boolean confirmEulaAcceptance(PreferenceTabbedPane gui, String eulaUrl) {
    774774            URL url = null;
    775775            try {
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r10003 r10043  
    345345    }
    346346
    347     private void minimizeSplitBounds(Split split, Rectangle bounds) {
     347    private static void minimizeSplitBounds(Split split, Rectangle bounds) {
    348348        Rectangle splitBounds = new Rectangle(bounds.x, bounds.y, 0, 0);
    349349        List<Node> splitChildren = split.getChildren();
     
    710710    }
    711711
    712     private void throwInvalidLayout(String msg, Node node) {
     712    private static void throwInvalidLayout(String msg, Node node) {
    713713        throw new InvalidLayoutException(msg, node);
    714714    }
     
    759759    }
    760760
    761     private Divider dividerAt(Node root, int x, int y) {
     761    private static Divider dividerAt(Node root, int x, int y) {
    762762        if (root instanceof Divider) {
    763763            Divider divider = (Divider) root;
     
    785785    }
    786786
    787     private boolean nodeOverlapsRectangle(Node node, Rectangle r2) {
     787    private static boolean nodeOverlapsRectangle(Node node, Rectangle r2) {
    788788        Rectangle r1 = node.getBounds();
    789789        return
  • trunk/src/org/openstreetmap/josm/io/NMEAImporter.java

    r8895 r10043  
    6767    }
    6868
    69     private void showNmeaInfobox(boolean success, NmeaReader r) {
     69    private static void showNmeaInfobox(boolean success, NmeaReader r) {
    7070        final StringBuilder msg = new StringBuilder(160).append("<html>");
    7171        msg.append(tr("Coordinates imported: {0}", r.getNumberOfCoordinates())).append("<br>")
  • trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java

    r9078 r10043  
    7373    }
    7474
    75     private File[] listFiles(File pluginsDirectory, final String regex) {
     75    private static File[] listFiles(File pluginsDirectory, final String regex) {
    7676        return pluginsDirectory.listFiles(
    7777                new FilenameFilter() {
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r9634 r10043  
    196196    }
    197197
    198     private void displayErrorMessage(final ProgressMonitor monitor, final String msg, final String details, final String title,
     198    private static void displayErrorMessage(final ProgressMonitor monitor, final String msg, final String details, final String title,
    199199            final String firstMessage) {
    200200        GuiHelper.runInEDTAndWait(new Runnable() {
  • trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java

    r9992 r10043  
    185185    private final TemplateEntry template;
    186186
    187     private Match transform(Match m, int searchExpressionPosition) throws ParseError {
     187    private static Match transform(Match m, int searchExpressionPosition) throws ParseError {
    188188        if (m instanceof Parent) {
    189189            Match child = transform(((Parent) m).getOperand(), searchExpressionPosition);
Note: See TracChangeset for help on using the changeset viewer.