Ignore:
Timestamp:
2015-10-13T23:50:14+02:00 (4 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/actions
Files:
19 edited

Legend:

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

    r8510 r8870  
    111111    }
    112112
    113     private JScrollPane createScrollPane(JosmTextArea area) {
     113    private static JScrollPane createScrollPane(JosmTextArea area) {
    114114        area.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    115115        area.setOpaque(false);
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r8840 r8870  
    291291     * @return List of nodes with more than one referrer
    292292     */
    293     private List<Node> collectNodesWithExternReferers(List<Way> ways) {
     293    private static List<Node> collectNodesWithExternReferers(List<Way> ways) {
    294294        List<Node> withReferrers = new ArrayList<>();
    295295        for (Way w: ways) {
     
    308308     * @return Nodes anticlockwise ordered
    309309     */
    310     private List<Node> collectNodesAnticlockwise(List<Way> ways) {
     310    private static List<Node> collectNodesAnticlockwise(List<Way> ways) {
    311311        List<Node> nodes = new ArrayList<>();
    312312        Node firstNode = ways.get(0).firstNode();
     
    355355     * @return true if action can be done
    356356     */
    357     private boolean actionAllowed(Collection<Node> nodes) {
     357    private static boolean actionAllowed(Collection<Node> nodes) {
    358358        boolean outside = false;
    359359        for (Node n: nodes) {
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r8836 r8870  
    8282     * @return A array of two nodes.
    8383     */
    84     private Node[] nodePairFurthestApart(List<Node> nodes) {
     84    private static Node[] nodePairFurthestApart(List<Node> nodes) {
    8585        // Detect if selected nodes are on the same way.
    8686
     
    134134     * @return An array containing the two most distant nodes.
    135135     */
    136     private Node[] nodeFurthestAppart(List<Node> nodes) {
     136    private static Node[] nodeFurthestAppart(List<Node> nodes) {
    137137        Node node1 = null, node2 = null;
    138138        double minSqDistance = 0;
     
    214214     * @throws InvalidSelection If the nodes have same coordinates.
    215215     */
    216     private Command alignOnlyNodes(List<Node> nodes) throws InvalidSelection {
     216    private static Command alignOnlyNodes(List<Node> nodes) throws InvalidSelection {
    217217        // Choose nodes used as anchor points for projection.
    218218        Node[] anchors = nodePairFurthestApart(nodes);
     
    232232     * @throws InvalidSelection if a polygon is selected, or if a node is used by 3 or more ways
    233233     */
    234     private Command alignMultiWay(Collection<Way> ways) throws InvalidSelection {
     234    private static Command alignMultiWay(Collection<Way> ways) throws InvalidSelection {
    235235        // Collect all nodes and compute line equation
    236236        Set<Node> nodes = new HashSet<>();
     
    270270     * @throws InvalidSelection if a node got more than 4 neighbours (self-crossing way)
    271271     */
    272     private List<Line> getInvolvedLines(Node node, List<Way> refWays) throws InvalidSelection {
     272    private static List<Line> getInvolvedLines(Node node, List<Way> refWays) throws InvalidSelection {
    273273        List<Line> lines = new ArrayList<>();
    274274        List<Node> neighbors = new ArrayList<>();
     
    327327     * @throws InvalidSelection if more than 2 lines
    328328     */
    329     private Command alignSingleNode(Node node, List<Line> lines) throws InvalidSelection {
     329    private static Command alignSingleNode(Node node, List<Line> lines) throws InvalidSelection {
    330330        if (lines.size() == 1)
    331331            return lines.get(0).projectionCommand(node);
  • trunk/src/org/openstreetmap/josm/actions/CopyAction.java

    r8510 r8870  
    8686    }
    8787
    88     private boolean isEmptySelection() {
     88    private static boolean isEmptySelection() {
    8989        Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    9090        if (sel.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java

    r8513 r8870  
    248248     * @return Modified nodes list ordered according hand traffic.
    249249     */
    250     private List<Node> orderNodesByTrafficHand(List<Node> nodes) {
     250    private static List<Node> orderNodesByTrafficHand(List<Node> nodes) {
    251251        boolean rightHandTraffic = true;
    252252        for (Node n: nodes) {
     
    268268     * @return Modified nodes list with same direction as way.
    269269     */
    270     private List<Node> orderNodesByWay(List<Node> nodes, Way way) {
     270    private static List<Node> orderNodesByWay(List<Node> nodes, Way way) {
    271271        List<Node> wayNodes = way.getNodes();
    272272        if (!way.isClosed()) {
  • trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

    r8795 r8870  
    172172    }
    173173
    174     private Relation getSelectedMultipolygonRelation() {
     174    private static Relation getSelectedMultipolygonRelation() {
    175175        return getSelectedMultipolygonRelation(getCurrentDataSet().getSelectedWays(), getCurrentDataSet().getSelectedRelations());
    176176    }
  • trunk/src/org/openstreetmap/josm/actions/DistributeAction.java

    r8795 r8870  
    112112     * @return true in this case
    113113     */
    114     private boolean checkDistributeWay(Collection<Way> ways, Collection<Node> nodes) {
     114    private static boolean checkDistributeWay(Collection<Way> ways, Collection<Node> nodes) {
    115115        if (ways.size() == 1 && nodes.size() <= 2) {
    116116            Way w = ways.iterator().next();
     
    137137     * @return Collection of command to be executed.
    138138     */
    139     private Collection<Command> distributeWay(Collection<Way> ways,
     139    private static Collection<Command> distributeWay(Collection<Way> ways,
    140140                                              Collection<Node> nodes) {
    141141        Way w = ways.iterator().next();
     
    201201     * @return true in this case
    202202     */
    203     private Boolean checkDistributeNodes(Collection<Way> ways, Collection<Node> nodes) {
     203    private static Boolean checkDistributeNodes(Collection<Way> ways, Collection<Node> nodes) {
    204204        return ways.isEmpty() && nodes.size() >= 3;
    205205    }
     
    284284     * @return Set of nodes without coordinates
    285285     */
    286     private Set<Node> removeNodesWithoutCoordinates(Collection<Node> col) {
     286    private static Set<Node> removeNodesWithoutCoordinates(Collection<Node> col) {
    287287        Set<Node> result = new HashSet<>();
    288288        for (Iterator<Node> it = col.iterator(); it.hasNext();) {
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8840 r8870  
    963963     * @return list of node paths to produce.
    964964     */
    965     private List<List<Node>> buildNodeChunks(Way way, Collection<Node> splitNodes) {
     965    private static List<List<Node>> buildNodeChunks(Way way, Collection<Node> splitNodes) {
    966966        List<List<Node>> result = new ArrayList<>();
    967967        List<Node> curList = new ArrayList<>();
  • trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java

    r8855 r8870  
    233233     * @see WMSLayer#checkGrabberType
    234234     */
    235     private void addWMSLayer(String title, String url) {
     235    private static void addWMSLayer(String title, String url) {
    236236        WMSLayer layer = new WMSLayer(new ImageryInfo(title, url));
    237237        Main.main.addLayer(layer);
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r8510 r8870  
    310310    }
    311311
    312     private boolean hasOnlyIncompleteMembers(Relation r, Collection<OsmPrimitive> toPurge, Collection<? extends OsmPrimitive> moreToPurge) {
     312    private static boolean hasOnlyIncompleteMembers(
     313            Relation r, Collection<OsmPrimitive> toPurge, Collection<? extends OsmPrimitive> moreToPurge) {
    313314        for (RelationMember m : r.getMembers()) {
    314315            if (!m.getMember().isIncomplete() && !toPurge.contains(m.getMember()) && !moreToPurge.contains(m.getMember()))
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r8846 r8870  
    303303     * </ul>
    304304     */
    305     private Way modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes) {
     305    private static Way modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes) {
    306306        // clone the node for the way
    307307        Node newNode = new Node(originalNode, true /* clear OSM ID */);
     
    396396     * @param newNodes New created nodes by this set of command
    397397     */
    398     private void execCommands(List<Command> cmds, List<Node> newNodes) {
     398    private static void execCommands(List<Command> cmds, List<Node> newNodes) {
    399399        Main.main.undoRedo.add(new SequenceCommand(/* for correct i18n of plural forms - see #9110 */
    400400                trn("Dupe into {0} node", "Dupe into {0} nodes", newNodes.size() + 1, newNodes.size() + 1), cmds));
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r8840 r8870  
    169169     * removes any highlighting that may have been set beforehand.
    170170     */
    171     private void removeHighlighting() {
     171    private static void removeHighlighting() {
    172172        highlightHelper.clear();
    173173        DataSet ds = getCurrentDataSet();
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r8855 r8870  
    831831    }
    832832
    833     private void showStatusInfo(double angle, double hdg, double distance, boolean activeFlag) {
     833    private static void showStatusInfo(double angle, double hdg, double distance, boolean activeFlag) {
    834834        Main.map.statusLine.setAngle(angle);
    835835        Main.map.statusLine.activateAnglePanel(activeFlag);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r8846 r8870  
    561561     * @param e current mouse point
    562562     */
    563     private void addNewNode(MouseEvent e) {
     563    private static void addNewNode(MouseEvent e) {
    564564        // Should maybe do the same as in DrawAction and fetch all nearby segments?
    565565        WaySegment ws = Main.map.mapView.getNearestWaySegment(e.getPoint(), OsmPrimitive.isSelectablePredicate);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ModifiersSpec.java

    r8470 r8870  
    4545    }
    4646
    47     private boolean match(final int a, final int knownValue) {
     47    private static boolean match(final int a, final int knownValue) {
    4848        assert knownValue == ON | knownValue == OFF;
    4949        return a == knownValue || a == UNKNOWN;
    5050    }
    5151
    52     private boolean match(final int a, final boolean knownValue) {
     52    private static boolean match(final int a, final boolean knownValue) {
    5353        return a == (knownValue ? ON : OFF) || a == UNKNOWN;
    5454    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r8808 r8870  
    362362    }
    363363
    364     private void removeWayHighlighting(Collection<Way> ways) {
     364    private static void removeWayHighlighting(Collection<Way> ways) {
    365365        if (ways == null)
    366366            return;
     
    566566    }
    567567
    568     private String prefKey(String subKey) {
     568    private static String prefKey(String subKey) {
    569569        return "edit.make-parallel-way-action." + subKey;
    570570    }
    571571
    572     private String getStringPref(String subKey, String def) {
     572    private static String getStringPref(String subKey, String def) {
    573573        return Main.pref.get(prefKey(subKey), def);
    574574    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r8846 r8870  
    772772    }
    773773
    774     private boolean doesImpactStatusLine(Collection<Node> affectedNodes, Collection<Way> selectedWays) {
     774    private static boolean doesImpactStatusLine(Collection<Node> affectedNodes, Collection<Way> selectedWays) {
    775775        for (Way w : selectedWays) {
    776776            for (Node n : w.getNodes()) {
     
    798798     * Obtain command in undoRedo stack to "continue" when dragging
    799799     */
    800     private Command getLastCommand() {
     800    private static Command getLastCommand() {
    801801        Command c = !Main.main.undoRedo.commands.isEmpty()
    802802                ? Main.main.undoRedo.commands.getLast() : null;
  • trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java

    r8510 r8870  
    5050    }
    5151
    52     private boolean checkMaxNodes(Collection<OsmPrimitive> primitives, long maxNodes) {
     52    private static boolean checkMaxNodes(Collection<OsmPrimitive> primitives, long maxNodes) {
    5353        for (OsmPrimitive osmPrimitive : primitives) {
    5454            for (String key: osmPrimitive.keySet()) {
  • trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java

    r8380 r8870  
    109109     *          if the user requested cancel.
    110110     */
    111     private boolean displayErrorScreen(List<TestError> errors) {
     111    private static boolean displayErrorScreen(List<TestError> errors) {
    112112        JPanel p = new JPanel(new GridBagLayout());
    113113        ValidatorTreePanel errorPanel = new ValidatorTreePanel(errors);
Note: See TracChangeset for help on using the changeset viewer.