Ignore:
Timestamp:
2013-10-07T20:18:17+02:00 (6 years ago)
Author:
Don-vip
Message:

Sonar/FindBugs - Loose coupling

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
15 edited

Legend:

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

    r6248 r6316  
    99import java.util.Collection;
    1010import java.util.Iterator;
     11import java.util.List;
    1112import java.util.regex.Pattern;
    1213
     
    117118
    118119    protected void launchInfoBrowsersForSelectedPrimitives() {
    119         ArrayList<OsmPrimitive> primitivesToShow = new ArrayList<OsmPrimitive>(getCurrentDataSet().getAllSelected());
     120        List<OsmPrimitive> primitivesToShow = new ArrayList<OsmPrimitive>(getCurrentDataSet().getAllSelected());
    120121
    121122        // filter out new primitives which are not yet uploaded to the server
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r6246 r6316  
    3232public final class AlignInLineAction extends JosmAction {
    3333
     34    /**
     35     * Constructs a new {@code AlignInLineAction}.
     36     */
    3437    public AlignInLineAction() {
    3538        super(tr("Align Nodes in Line"), "alignline", tr("Move the selected nodes in to a line."),
     
    3942
    4043    // the joy of single return values only...
    41     private void nodePairFurthestApart(ArrayList<Node> nodes, Node[] resultOut) {
     44    private void nodePairFurthestApart(List<Node> nodes, Node[] resultOut) {
    4245        if(resultOut.length < 2)
    4346            throw new IllegalArgumentException();
     
    107110        List<Node> selectedNodes = new ArrayList<Node>(getCurrentDataSet().getSelectedNodes());
    108111        Collection<Way> selectedWays = getCurrentDataSet().getSelectedWays();
    109         ArrayList<Node> nodes = new ArrayList<Node>();
     112        List<Node> nodes = new ArrayList<Node>();
    110113
    111114        //// Decide what to align based on selection:
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r6156 r6316  
    374374    static public class NodeGraph {
    375375        static public List<NodePair> buildNodePairs(Way way, boolean directed) {
    376             ArrayList<NodePair> pairs = new ArrayList<NodePair>();
     376            List<NodePair> pairs = new ArrayList<NodePair>();
    377377            for (Pair<Node,Node> pair: way.getNodePairs(false /* don't sort */)) {
    378378                pairs.add(new NodePair(pair));
     
    385385
    386386        static public List<NodePair> buildNodePairs(List<Way> ways, boolean directed) {
    387             ArrayList<NodePair> pairs = new ArrayList<NodePair>();
     387            List<NodePair> pairs = new ArrayList<NodePair>();
    388388            for (Way w: ways) {
    389389                pairs.addAll(buildNodePairs(w, directed));
     
    393393
    394394        static public List<NodePair> eliminateDuplicateNodePairs(List<NodePair> pairs) {
    395             ArrayList<NodePair> cleaned = new ArrayList<NodePair>();
     395            List<NodePair> cleaned = new ArrayList<NodePair>();
    396396            for(NodePair p: pairs) {
    397397                if (!cleaned.contains(p) && !cleaned.contains(p.swap())) {
     
    446446                }
    447447            } else {
    448                 ArrayList<NodePair> l = new ArrayList<NodePair>();
     448                List<NodePair> l = new ArrayList<NodePair>();
    449449                l.add(pair);
    450450                successors.put(pair.getA(), l);
     
    458458                }
    459459            } else {
    460                 ArrayList<NodePair> l = new ArrayList<NodePair>();
     460                List<NodePair> l = new ArrayList<NodePair>();
    461461                l.add(pair);
    462462                predecessors.put(pair.getB(), l);
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r6265 r6316  
    457457        commitCommands(marktr("Added node on all intersections"));
    458458
    459         ArrayList<RelationRole> relations = new ArrayList<RelationRole>();
     459        List<RelationRole> relations = new ArrayList<RelationRole>();
    460460
    461461        // Remove ways from all relations so ways can be combined/split quietly
     
    467467        boolean warnAboutRelations = !relations.isEmpty() && allStartingWays.size() > 1;
    468468
    469         ArrayList<WayInPolygon> preparedWays = new ArrayList<WayInPolygon>();
     469        List<WayInPolygon> preparedWays = new ArrayList<WayInPolygon>();
    470470
    471471        for (Way way : outerStartingWays) {
    472             ArrayList<Way> splitWays = splitWayOnNodes(way, nodes);
     472            List<Way> splitWays = splitWayOnNodes(way, nodes);
    473473            preparedWays.addAll(markWayInsideSide(splitWays, false));
    474474        }
    475475
    476476        for (Way way : innerStartingWays) {
    477             ArrayList<Way> splitWays = splitWayOnNodes(way, nodes);
     477            List<Way> splitWays = splitWayOnNodes(way, nodes);
    478478            preparedWays.addAll(markWayInsideSide(splitWays, true));
    479479        }
    480480
    481481        // Find boundary ways
    482         ArrayList<Way> discardedWays = new ArrayList<Way>();
     482        List<Way> discardedWays = new ArrayList<Way>();
    483483        List<AssembledPolygon> bounadries = findBoundaryPolygons(preparedWays, discardedWays);
    484484
     
    659659     * @return list of parts, marked with the inside orientation.
    660660     */
    661     private ArrayList<WayInPolygon> markWayInsideSide(List<Way> parts, boolean isInner) {
    662 
    663         ArrayList<WayInPolygon> result = new ArrayList<WayInPolygon>();
     661    private List<WayInPolygon> markWayInsideSide(List<Way> parts, boolean isInner) {
     662
     663        List<WayInPolygon> result = new ArrayList<WayInPolygon>();
    664664
    665665        //prepare prev and next maps
     
    829829     * @return list of split ways (or original ways if no splitting is done).
    830830     */
    831     private ArrayList<Way> splitWayOnNodes(Way way, Set<Node> nodes) {
    832 
    833         ArrayList<Way> result = new ArrayList<Way>();
     831    private List<Way> splitWayOnNodes(Way way, Set<Node> nodes) {
     832
     833        List<Way> result = new ArrayList<Way>();
    834834        List<List<Node>> chunks = buildNodeChunks(way, nodes);
    835835
     
    13441344     * @return List of relations with roles the primitives was part of
    13451345     */
    1346     private ArrayList<RelationRole> removeFromAllRelations(OsmPrimitive osm) {
    1347         ArrayList<RelationRole> result = new ArrayList<RelationRole>();
     1346    private List<RelationRole> removeFromAllRelations(OsmPrimitive osm) {
     1347        List<RelationRole> result = new ArrayList<RelationRole>();
    13481348
    13491349        for (Relation r : Main.main.getCurrentDataSet().getRelations()) {
     
    13831383     * @param relationsToDelete set of relations to delete.
    13841384     */
    1385     private void fixRelations(ArrayList<RelationRole> rels, Way outer, RelationRole ownMultipol, Set<Relation> relationsToDelete) {
    1386         ArrayList<RelationRole> multiouters = new ArrayList<RelationRole>();
    1387 
    1388         if (ownMultipol != null){
     1385    private void fixRelations(List<RelationRole> rels, Way outer, RelationRole ownMultipol, Set<Relation> relationsToDelete) {
     1386        List<RelationRole> multiouters = new ArrayList<RelationRole>();
     1387
     1388        if (ownMultipol != null) {
    13891389            multiouters.add(ownMultipol);
    13901390        }
  • trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java

    r6246 r6316  
    99import java.awt.event.KeyEvent;
    1010import java.util.ArrayList;
     11import java.util.List;
    1112import java.util.regex.Matcher;
    1213import java.util.regex.Pattern;
     
    6364     * List of available rectifier services. May be extended from the outside
    6465     */
    65     public ArrayList<RectifierService> services = new ArrayList<RectifierService>();
     66    public List<RectifierService> services = new ArrayList<RectifierService>();
    6667
    6768    public MapRectifierWMSmenuAction() {
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r6275 r6316  
    198198
    199199        for (Way w: OsmPrimitive.getFilteredList(OsmPrimitive.getReferrer(nodesToDelete), Way.class)) {
    200             ArrayList<Node> newNodes = new ArrayList<Node>(w.getNodesCount());
     200            List<Node> newNodes = new ArrayList<Node>(w.getNodesCount());
    201201            for (Node n: w.getNodes()) {
    202202                if (! nodesToDelete.contains(n) && n != targetNode) {
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r6296 r6316  
    4444            "You can add two nodes to the selection. Then, the direction is fixed by these two reference nodes. "+
    4545            "(Afterwards, you can undo the movement for certain nodes:<br>"+
    46     "Select them and press the shortcut for Orthogonalize / Undo. The default is Shift-Q.)");
     46            "Select them and press the shortcut for Orthogonalize / Undo. The default is Shift-Q.)");
    4747
    4848    /**
     
    144144        }
    145145
    146         final ArrayList<Node> nodeList = new ArrayList<Node>();
    147         final ArrayList<WayData> wayDataList = new ArrayList<WayData>();
     146        final List<Node> nodeList = new ArrayList<Node>();
     147        final List<WayData> wayDataList = new ArrayList<WayData>();
    148148        final Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    149149
     
    170170                    }
    171171                    else if (nodeList.isEmpty()) {
    172                         List<ArrayList<WayData>> groups = buildGroups(wayDataList);
    173                         for (ArrayList<WayData> g: groups) {
     172                        List<List<WayData>> groups = buildGroups(wayDataList);
     173                        for (List<WayData> g: groups) {
    174174                            commands.addAll(orthogonalize(g, nodeList));
    175175                        }
     
    200200     * Collect groups of ways with common nodes in order to orthogonalize each group separately.
    201201     */
    202     private static List<ArrayList<WayData>> buildGroups(ArrayList<WayData> wayDataList) {
    203         List<ArrayList<WayData>> groups = new ArrayList<ArrayList<WayData>>();
     202    private static List<List<WayData>> buildGroups(List<WayData> wayDataList) {
     203        List<List<WayData>> groups = new ArrayList<List<WayData>>();
    204204        Set<WayData> remaining = new HashSet<WayData>(wayDataList);
    205205        while (!remaining.isEmpty()) {
    206             ArrayList<WayData> group = new ArrayList<WayData>();
     206            List<WayData> group = new ArrayList<WayData>();
    207207            groups.add(group);
    208208            Iterator<WayData> it = remaining.iterator();
     
    247247     *
    248248     **/
    249     private static Collection<Command> orthogonalize(ArrayList<WayData> wayDataList, ArrayList<Node> headingNodes)
    250     throws InvalidUserInputException
    251     {
     249    private static Collection<Command> orthogonalize(List<WayData> wayDataList, List<Node> headingNodes) throws InvalidUserInputException {
    252250        // find average heading
    253251        double headingAll;
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r6289 r6316  
    297297        cmds.add(new AddCommand(newNode));
    298298
    299         ArrayList<Node> nn = new ArrayList<Node>();
     299        List<Node> nn = new ArrayList<Node>();
    300300        for (Node pushNode : w.getNodes()) {
    301301            if (originalNode == pushNode) {
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r6084 r6316  
    88import java.awt.event.KeyEvent;
    99import java.util.LinkedList;
     10import java.util.List;
    1011
    1112import javax.swing.JOptionPane;
     
    5152     * however, a plugin might also want to insert something after that.
    5253     */
    53     private static final LinkedList<UploadHook> uploadHooks = new LinkedList<UploadHook>();
    54     private static final LinkedList<UploadHook> lateUploadHooks = new LinkedList<UploadHook>();
     54    private static final List<UploadHook> uploadHooks = new LinkedList<UploadHook>();
     55    private static final List<UploadHook> lateUploadHooks = new LinkedList<UploadHook>();
    5556    static {
    5657        /**
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java

    r6069 r6316  
    141141     */
    142142    protected void updatePotentiallyDeletedPrimitives(Set<OsmPrimitive> potentiallyDeleted) {
    143         final ArrayList<OsmPrimitive> toSelect = new ArrayList<OsmPrimitive>();
     143        final List<OsmPrimitive> toSelect = new ArrayList<OsmPrimitive>();
    144144        for (OsmPrimitive primitive : potentiallyDeleted) {
    145145            if (primitive != null) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r6310 r6316  
    424424        Collection<OsmPrimitive> newSelection = new LinkedList<OsmPrimitive>(ds.getSelected());
    425425
    426         ArrayList<Way> reuseWays = new ArrayList<Way>(),
     426        List<Way> reuseWays = new ArrayList<Way>(),
    427427                replacedWays = new ArrayList<Way>();
    428428        boolean newNode = false;
     
    652652    }
    653653
    654     private void insertNodeIntoAllNearbySegments(List<WaySegment> wss, Node n, Collection<OsmPrimitive> newSelection, Collection<Command> cmds, ArrayList<Way> replacedWays, ArrayList<Way> reuseWays) {
     654    private void insertNodeIntoAllNearbySegments(List<WaySegment> wss, Node n, Collection<OsmPrimitive> newSelection, Collection<Command> cmds, List<Way> replacedWays, List<Way> reuseWays) {
    655655        Map<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>();
    656656        for (WaySegment ws : wss) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r6310 r6316  
    613613     */
    614614    private void updateStateByCurrentSelection() {
    615         final ArrayList<Node> nodeList = new ArrayList<Node>();
    616         final ArrayList<Way> wayList = new ArrayList<Way>();
     615        final List<Node> nodeList = new ArrayList<Node>();
     616        final List<Way> wayList = new ArrayList<Way>();
    617617        final Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    618618
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r6310 r6316  
    33
    44import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
     5import static org.openstreetmap.josm.tools.I18n.marktr;
    56import static org.openstreetmap.josm.tools.I18n.tr;
    67
     
    1819import java.util.Collection;
    1920import java.util.LinkedHashSet;
     21import java.util.Set;
    2022
    2123import javax.swing.JOptionPane;
     
    4042import org.openstreetmap.josm.gui.util.GuiHelper;
    4143import org.openstreetmap.josm.tools.Geometry;
    42 import static org.openstreetmap.josm.tools.I18n.marktr;
    4344import org.openstreetmap.josm.tools.ImageProvider;
    4445import org.openstreetmap.josm.tools.Shortcut;
     
    122123    private WaySegment referenceSegment;
    123124    private ParallelWays pWays;
    124     private LinkedHashSet<Way> sourceWays;
     125    private Set<Way> sourceWays;
    125126    private EastNorth helperLineStart;
    126127    private EastNorth helperLineEnd;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java

    r6069 r6316  
    178178
    179179    private List<Command> makeAddWayAndNodesCommandList() {
    180         ArrayList<Command> commands = new ArrayList<Command>(sortedNodes.size() + ways.size());
     180        List<Command> commands = new ArrayList<Command>(sortedNodes.size() + ways.size());
    181181        for (int i = 0; i < sortedNodes.size() - (isClosedPath() ? 1 : 0); i++) {
    182182            commands.add(new AddCommand(sortedNodes.get(i)));
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r6248 r6316  
    111111
    112112    public static List<String> getSearchExpressionHistory() {
    113         ArrayList<String> ret = new ArrayList<String>(getSearchHistory().size());
     113        List<String> ret = new ArrayList<String>(getSearchHistory().size());
    114114        for (SearchSetting ss: getSearchHistory()) {
    115115            ret.add(ss.text);
     
    120120    private static SearchSetting lastSearch = null;
    121121
     122    /**
     123     * Constructs a new {@code SearchAction}.
     124     */
    122125    public SearchAction() {
    123126        super(tr("Search..."), "dialogs/search", tr("Search for objects."),
Note: See TracChangeset for help on using the changeset viewer.