Changeset 6317 in josm


Ignore:
Timestamp:
2013-10-07T22:45:15+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar/FindBugs - Loose coupling

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

Legend:

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

    r6316 r6317  
    1010import java.util.Collection;
    1111import java.util.Collections;
    12 import java.util.HashMap;
    1312import java.util.HashSet;
    1413import java.util.LinkedHashMap;
     
    1615import java.util.LinkedList;
    1716import java.util.List;
     17import java.util.Map;
    1818import java.util.Set;
    1919import java.util.Stack;
     
    427427        }
    428428
    429         static public NodeGraph createUndirectedGraphFromNodeWays(Collection<Way> ways) {
     429        public static NodeGraph createUndirectedGraphFromNodeWays(Collection<Way> ways) {
    430430            NodeGraph graph = new NodeGraph();
    431431            for (Way w: ways) {
     
    437437        private Set<NodePair> edges;
    438438        private int numUndirectedEges = 0;
    439         private HashMap<Node, List<NodePair>> successors;
    440         private HashMap<Node, List<NodePair>> predecessors;
     439        private Map<Node, List<NodePair>> successors;
     440        private Map<Node, List<NodePair>> predecessors;
    441441
    442442        protected void rememberSuccessor(NodePair pair) {
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r6316 r6317  
    1717import java.util.LinkedList;
    1818import java.util.List;
     19import java.util.Map;
    1920import java.util.Set;
    2021
     
    7172     * Remember movements, so the user can later undo it for certain nodes
    7273     */
    73     private static final HashMap<Node, EastNorth> rememberMovements = new HashMap<Node, EastNorth>();
     74    private static final Map<Node, EastNorth> rememberMovements = new HashMap<Node, EastNorth>();
    7475
    7576    /**
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r6316 r6317  
    301301    // events for crossplatform key holding processing
    302302    // thanks to http://www.arco.in-berlin.de/keyevent.html
    303     private final TreeSet<Integer> set = new TreeSet<Integer>();
     303    private final Set<Integer> set = new TreeSet<Integer>();
    304304    private KeyEvent releaseEvent;
    305305    private Timer timer;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r6310 r6317  
    367367    }
    368368
    369     private boolean repaintIfRequired(HashSet<OsmPrimitive> newHighlights) {
     369    private boolean repaintIfRequired(Set<OsmPrimitive> newHighlights) {
    370370        if(!drawTargetHighlight)
    371371            return false;
  • trunk/src/org/openstreetmap/josm/data/APIDataSet.java

    r6316 r6317  
    1010import java.util.LinkedList;
    1111import java.util.List;
     12import java.util.Map;
    1213import java.util.Set;
    1314import java.util.Stack;
     
    3536 */
    3637public class APIDataSet {
    37     private LinkedList<OsmPrimitive> toAdd;
    38     private LinkedList<OsmPrimitive> toUpdate;
    39     private LinkedList<OsmPrimitive> toDelete;
     38    private List<OsmPrimitive> toAdd;
     39    private List<OsmPrimitive> toUpdate;
     40    private List<OsmPrimitive> toDelete;
    4041
    4142    /**
     
    267268     */
    268269    private static class RelationUploadDependencyGraph {
    269         private HashMap<Relation, Set<Relation>> children;
     270        private Map<Relation, Set<Relation>> children;
    270271        private Collection<Relation> relations;
    271272        private Set<Relation> visited;
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r6312 r6317  
    476476    }
    477477
    478     synchronized public TreeMap<String, String> getAllColors() {
    479         final TreeMap<String,String> all = new TreeMap<String,String>();
     478    synchronized public Map<String, String> getAllColors() {
     479        final Map<String,String> all = new TreeMap<String,String>();
    480480        for (final Entry<String,String> e : defaults.entrySet()) {
    481481            if (e.getKey().startsWith("color.") && e.getValue() != null) {
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r6248 r6317  
    88import java.net.URL;
    99import java.util.HashMap;
     10import java.util.Map;
    1011import java.util.Map.Entry;
    1112import java.util.regex.Matcher;
     
    7475    private boolean isLocalBuild;
    7576
    76     protected HashMap<String, String> parseManifestStyleFormattedString(String content) {
    77         HashMap<String, String> properties = new HashMap<String, String>();
     77    protected Map<String, String> parseManifestStyleFormattedString(String content) {
     78        Map<String, String> properties = new HashMap<String, String>();
    7879        if (content == null) return properties;
    7980        Pattern p = Pattern.compile("^([^:]+):(.*)$");
     
    106107        }
    107108
    108         HashMap<String, String> properties = parseManifestStyleFormattedString(revisionInfo);
     109        Map<String, String> properties = parseManifestStyleFormattedString(revisionInfo);
    109110        String value = properties.get("Revision");
    110111        if (value != null) {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r6285 r6317  
    1515import java.util.List;
    1616import java.util.Map;
     17import java.util.Set;
    1718import java.util.concurrent.CopyOnWriteArrayList;
    1819import java.util.concurrent.locks.Lock;
     
    432433    }
    433434
    434     private LinkedHashSet<OsmPrimitive> selectedPrimitives = new LinkedHashSet<OsmPrimitive>();
     435    private Set<OsmPrimitive> selectedPrimitives = new LinkedHashSet<OsmPrimitive>();
    435436    private Collection<OsmPrimitive> selectionSnapshot;
    436437
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r6296 r6317  
    140140     * @return the sub-set of OSM primitives of type <code>type</code>
    141141     */
    142     static public <T extends OsmPrimitive>  LinkedHashSet<T> getFilteredSet(Collection<OsmPrimitive> set, Class<T> type) {
    143         LinkedHashSet<T> ret = new LinkedHashSet<T>();
     142    static public <T extends OsmPrimitive> Set<T> getFilteredSet(Collection<OsmPrimitive> set, Class<T> type) {
     143        Set<T> ret = new LinkedHashSet<T>();
    144144        if (set != null) {
    145145            for(OsmPrimitive p: set) {
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java

    r6084 r6317  
    44import java.util.Comparator;
    55import java.util.HashMap;
     6import java.util.Map;
    67
    78import org.openstreetmap.josm.gui.DefaultNameFormatter;
     
    910/** Comparator, comparing by type and objects display names */
    1011public class OsmPrimitiveComparator implements Comparator<OsmPrimitive> {
    11     final private HashMap<OsmPrimitive, String> cache= new HashMap<OsmPrimitive, String>();
     12    final private Map<OsmPrimitive, String> cache= new HashMap<OsmPrimitive, String>();
    1213    final private DefaultNameFormatter df = DefaultNameFormatter.getInstance();
    1314    public boolean relationsFirst = false;
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r6087 r6317  
    139139    }
    140140
    141     private final HashSet<Tag> tags = new HashSet<Tag>();
     141    private final Set<Tag> tags = new HashSet<Tag>();
    142142
    143143    /**
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r6316 r6317  
    88import java.util.HashSet;
    99import java.util.List;
     10import java.util.Map;
     11import java.util.Set;
    1012import java.util.concurrent.atomic.AtomicLong;
    1113
     
    2830     * the map of known users
    2931     */
    30     private static HashMap<Long,User> userMap = new HashMap<Long,User>();
     32    private static Map<Long,User> userMap = new HashMap<Long,User>();
    3133    private final static User anonymous = createLocalUser(tr("<anonymous>"));
    3234
     
    118120
    119121    /** the user name */
    120     private final HashSet<String> names = new HashSet<String>();
     122    private final Set<String> names = new HashSet<String>();
    121123    /** the user id */
    122124    private final long uid;
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java

    r6316 r6317  
    66import java.util.HashMap;
    77import java.util.List;
     8import java.util.Map;
    89import java.util.concurrent.CopyOnWriteArrayList;
    910
     
    4041
    4142    /** the history data */
    42     private HashMap<PrimitiveId, ArrayList<HistoryOsmPrimitive>> data;
     43    private Map<PrimitiveId, ArrayList<HistoryOsmPrimitive>> data;
    4344    private CopyOnWriteArrayList<HistoryDataSetListener> listeners;
    4445
     46    /**
     47     * Constructs a new {@code HistoryDataSet}.
     48     */
    4549    public HistoryDataSet() {
    4650        data = new HashMap<PrimitiveId, ArrayList<HistoryOsmPrimitive>>();
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r6296 r6317  
    3434    private Date timestamp;
    3535    private long version;
    36     private HashMap<String, String> tags;
     36    private Map<String, String> tags;
    3737
    3838    protected void ensurePositiveLong(long value, String name) {
    39         if (value <= 0)
     39        if (value <= 0) {
    4040            throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0 expected. Got ''{1}''.", name, value));
     41        }
    4142    }
    4243
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java

    r6316 r6317  
    7070     * @throws IllegalArgumentException thrown if preconditions are violated
    7171     */
    72     public HistoryRelation(long id, long version, boolean visible, User user, long changesetId,
    73             Date timestamp, ArrayList<RelationMemberData> members) {
     72    public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, Date timestamp, List<RelationMemberData> members) {
    7473        this(id, version, visible, user, changesetId, timestamp);
    7574        if (members != null) {
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java

    r6316 r6317  
    6868     * @throws IllegalArgumentException if preconditions are violated
    6969     */
    70     public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp, ArrayList<Long> nodeIdList) throws IllegalArgumentException {
     70    public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp, List<Long> nodeIdList) throws IllegalArgumentException {
    7171        this(id, version, visible, user, changesetId, timestamp);
    7272        CheckParameterUtil.ensureParameterNotNull(nodeIdList, "nodeIdList");
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r6084 r6317  
    55import java.util.HashMap;
    66import java.util.List;
     7import java.util.Map;
    78
    89import org.openstreetmap.josm.data.osm.DataSet;
     
    3334    private DataSet selectionBase;
    3435    private DataSet hull;
    35     private HashMap<OsmPrimitive, PrimitiveData> mappedPrimitives;
     36    private Map<OsmPrimitive, PrimitiveData> mappedPrimitives;
    3637
    3738    /**
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r6313 r6317  
    15421542    }
    15431543
    1544     private LinkedList<CursorInfo> Cursors = new LinkedList<CursorInfo>();
     1544    private LinkedList<CursorInfo> cursors = new LinkedList<CursorInfo>();
     1545   
    15451546    /**
    15461547     * Set new cursor.
    15471548     */
    15481549    public void setNewCursor(Cursor cursor, Object reference) {
    1549         if(!Cursors.isEmpty()) {
    1550             CursorInfo l = Cursors.getLast();
     1550        if (!cursors.isEmpty()) {
     1551            CursorInfo l = cursors.getLast();
    15511552            if(l != null && l.cursor == cursor && l.object == reference)
    15521553                return;
    15531554            stripCursors(reference);
    15541555        }
    1555         Cursors.add(new CursorInfo(cursor, reference));
     1556        cursors.add(new CursorInfo(cursor, reference));
    15561557        setCursor(cursor);
    15571558    }
     1559   
    15581560    public void setNewCursor(int cursor, Object reference) {
    15591561        setNewCursor(Cursor.getPredefinedCursor(cursor), reference);
    15601562    }
     1563   
    15611564    /**
    15621565     * Remove the new cursor and reset to previous
    15631566     */
    15641567    public void resetCursor(Object reference) {
    1565         if(Cursors.isEmpty()) {
     1568        if (cursors.isEmpty()) {
    15661569            setCursor(null);
    15671570            return;
    15681571        }
    1569         CursorInfo l = Cursors.getLast();
     1572        CursorInfo l = cursors.getLast();
    15701573        stripCursors(reference);
    1571         if(l != null && l.object == reference) {
    1572             if(Cursors.isEmpty()) {
     1574        if (l != null && l.object == reference) {
     1575            if (cursors.isEmpty()) {
    15731576                setCursor(null);
    15741577            } else {
    1575                 setCursor(Cursors.getLast().cursor);
     1578                setCursor(cursors.getLast().cursor);
    15761579            }
    15771580        }
     
    15801583    private void stripCursors(Object reference) {
    15811584        LinkedList<CursorInfo> c = new LinkedList<CursorInfo>();
    1582         for(CursorInfo i : Cursors) {
     1585        for(CursorInfo i : cursors) {
    15831586            if(i.object != reference) {
    15841587                c.add(i);
    15851588            }
    15861589        }
    1587         Cursors = c;
     1590        cursors = c;
    15881591    }
    15891592
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r6316 r6317  
    831831    public class ComparePairListModel extends AbstractListModel implements ComboBoxModel {
    832832
    833         private  int selectedIdx;
    834         private final ArrayList<ComparePairType> compareModes;
     833        private int selectedIdx;
     834        private final List<ComparePairType> compareModes;
    835835
    836836        public ComparePairListModel() {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerModel.java

    r6316 r6317  
    3030    public final static String CHANGESET_IN_DETAIL_VIEW_PROP = ChangesetCacheManagerModel.class.getName() + ".changesetInDetailView";
    3131
    32     private final ArrayList<Changeset> data = new ArrayList<Changeset>();
     32    private final List<Changeset> data = new ArrayList<Changeset>();
    3333    private DefaultListSelectionModel selectionModel;
    3434    private Changeset changesetInDetailView;
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r6316 r6317  
    424424
    425425    protected static class AvailableSourcesListModel extends DefaultListModel {
    426         private ArrayList<ExtendedSourceEntry> data;
     426        private List<ExtendedSourceEntry> data;
    427427        private DefaultListSelectionModel selectionModel;
    428428
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r6296 r6317  
    475475
    476476    public JToolBar control = new JToolBar();
    477     private HashMap<Object, ActionDefinition> buttonActions = new HashMap<Object, ActionDefinition>(30);
     477    private Map<Object, ActionDefinition> buttonActions = new HashMap<Object, ActionDefinition>(30);
    478478
    479479    @Override
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java

    r6084 r6317  
    1111import java.util.LinkedList;
    1212import java.util.List;
     13import java.util.Map;
    1314import java.util.Observable;
    1415import java.util.Set;
     
    2122
    2223public class PluginPreferencesModel extends Observable{
    23     private final ArrayList<PluginInformation> availablePlugins = new ArrayList<PluginInformation>();
    24     private final ArrayList<PluginInformation> displayedPlugins = new ArrayList<PluginInformation>();
    25     private final HashMap<PluginInformation, Boolean> selectedPluginsMap = new HashMap<PluginInformation, Boolean>();
     24    private final List<PluginInformation> availablePlugins = new ArrayList<PluginInformation>();
     25    private final List<PluginInformation> displayedPlugins = new ArrayList<PluginInformation>();
     26    private final Map<PluginInformation, Boolean> selectedPluginsMap = new HashMap<PluginInformation, Boolean>();
    2627    private Set<String> pendingDownloads = new HashSet<String>();
    2728    private String filterExpression;
    2829    private Set<String> currentActivePlugins;
    2930
     31    /**
     32     * Constructs a new {@code PluginPreferencesModel}.
     33     */
    3034    public PluginPreferencesModel() {
    3135        currentActivePlugins = new HashSet<String>();
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java

    r6316 r6317  
    3131
    3232    /** the bare list of AutoCompletionItems */
    33     private ArrayList<AutoCompletionListItem> list = null;
     33    private List<AutoCompletionListItem> list = null;
    3434    /**  the filtered list of AutoCompletionItems */
    3535    private ArrayList<AutoCompletionListItem> filtered = null;
  • trunk/src/org/openstreetmap/josm/gui/util/TableCellEditorSupport.java

    r3083 r6317  
    1111public class TableCellEditorSupport {
    1212    private Object editor;
    13     private LinkedList<CellEditorListener> listeners;
     13    private List<CellEditorListener> listeners;
    1414
    1515    public TableCellEditorSupport(Object editor) {
  • trunk/src/org/openstreetmap/josm/io/Capabilities.java

    r6316 r6317  
    88import java.util.HashMap;
    99import java.util.List;
     10import java.util.Map;
    1011
    1112import org.openstreetmap.josm.Main;
     
    4243public class Capabilities {
    4344
    44     private HashMap<String, HashMap<String,String>> capabilities;
     45    private Map<String, HashMap<String,String>> capabilities;
    4546    private List<String> imageryBlacklist;
    4647
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r6313 r6317  
    2424import java.util.Collections;
    2525import java.util.HashMap;
     26import java.util.Map;
    2627
    2728import javax.xml.parsers.ParserConfigurationException;
     
    7576
    7677    // The collection of instantiated OSM APIs
    77     private static HashMap<String, OsmApi> instances = new HashMap<String, OsmApi>();
     78    private static Map<String, OsmApi> instances = new HashMap<String, OsmApi>();
    7879
    7980    /**
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r6310 r6317  
    103103    }
    104104
    105     private static double parseDouble(HashMap<String, String> map, String key) {
     105    private static double parseDouble(Map<String, String> map, String key) {
    106106        if (map.containsKey(key))
    107107            return Double.parseDouble(map.get(key));
Note: See TracChangeset for help on using the changeset viewer.