Changeset 30737 in osm for applications/editors/josm/plugins/turnrestrictions
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/turnrestrictions
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java
r30365 r30737 77 77 */ 78 78 static public Node getUniqueCommonNode(Way w1, Way w2) throws IllegalArgumentException{ 79 Set<Node> w1Nodes = new HashSet< Node>(w1.getNodes());79 Set<Node> w1Nodes = new HashSet<>(w1.getNodes()); 80 80 w1Nodes.retainAll(w2.getNodes()); 81 81 if (w1Nodes.size() != 1) return null; … … 295 295 public synchronized Relation buildFromSelection(OsmDataLayer layer) { 296 296 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 297 List<OsmPrimitive> selection = new ArrayList< OsmPrimitive>(layer.data.getSelected());297 List<OsmPrimitive> selection = new ArrayList<>(layer.data.getSelected()); 298 298 return build(selection); 299 299 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdTransferable.java
r23510 r30737 35 35 36 36 37 private List<PrimitiveId> ids = new ArrayList< PrimitiveId>();37 private List<PrimitiveId> ids = new ArrayList<>(); 38 38 39 39 /** -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModel.java
r30651 r30737 20 20 static public final Set<String> STANDARD_VEHICLE_EXCEPTION_VALUES; 21 21 static { 22 HashSet<String> s = new HashSet< String>();22 HashSet<String> s = new HashSet<>(); 23 23 s.add("psv"); 24 24 s.add("hgv"); … … 44 44 private String value = ""; 45 45 private boolean isStandard = true; 46 private final Set<String> vehicleExceptions = new HashSet< String>();46 private final Set<String> vehicleExceptions = new HashSet<>(); 47 47 48 48 protected void parseValue(String value) { … … 91 91 // is based on getValue() 92 92 // 93 List<String> values = new ArrayList< String>(vehicleExceptions);93 List<String> values = new ArrayList<>(vehicleExceptions); 94 94 Collections.sort(values); 95 95 for (String v: values){ -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java
r30454 r30737 37 37 //static private final Logger logger = Logger.getLogger(JosmSelectionListModel.class.getName()); 38 38 39 private final List<OsmPrimitive> selection = new ArrayList< OsmPrimitive>();39 private final List<OsmPrimitive> selection = new ArrayList<>(); 40 40 private final DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); 41 41 private OsmDataLayer layer; … … 69 69 */ 70 70 public Collection<OsmPrimitive> getSelected() { 71 Set<OsmPrimitive> sel = new HashSet< OsmPrimitive>();71 Set<OsmPrimitive> sel = new HashSet<>(); 72 72 for(int i=0; i< getSize();i++) { 73 73 if (selectionModel.isSelectedIndex(i)) { … … 219 219 /* ------------------------------------------------------------------------ */ 220 220 public List<PrimitiveId> getSelectedPrimitiveIds() { 221 List<PrimitiveId> ret = new ArrayList< PrimitiveId>(getSelected().size());221 List<PrimitiveId> ret = new ArrayList<>(getSelected().size()); 222 222 for(int i=0; i< selection.size(); i++) { 223 223 if (selectionModel.isSelectedIndex(i)) { -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberEditorModel.java
r30365 r30737 25 25 public class RelationMemberEditorModel extends AbstractTableModel{ 26 26 //static private final Logger logger = Logger.getLogger(RelationMemberEditorModel.class.getName()); 27 private final ArrayList<RelationMemberModel> members = new ArrayList< RelationMemberModel>();27 private final ArrayList<RelationMemberModel> members = new ArrayList<>(); 28 28 private OsmDataLayer layer; 29 29 private DefaultListSelectionModel rowSelectionModel; … … 89 89 */ 90 90 protected Set<OsmPrimitive> getPrimitivesWithRole(String role) { 91 HashSet<OsmPrimitive> ret = new HashSet< OsmPrimitive>();91 HashSet<OsmPrimitive> ret = new HashSet<>(); 92 92 for (RelationMemberModel rm: members){ 93 93 if (rm.getRole().equals(role)){ … … 108 108 */ 109 109 protected List<RelationMemberModel> getRelationMembersWithRole(String role) { 110 ArrayList<RelationMemberModel> ret = new ArrayList< RelationMemberModel>();110 ArrayList<RelationMemberModel> ret = new ArrayList<>(); 111 111 for (RelationMemberModel rm: members){ 112 112 if (rm.getRole().equals(role)){ … … 163 163 */ 164 164 public List<OsmPrimitive> getVias() { 165 ArrayList<OsmPrimitive> ret = new ArrayList< OsmPrimitive>();165 ArrayList<OsmPrimitive> ret = new ArrayList<>(); 166 166 for (RelationMemberModel rm: getRelationMembersWithRole("via")){ 167 167 ret.add(layer.data.getPrimitiveById(rm.getTarget())); … … 268 268 */ 269 269 public Set<OsmPrimitive> getMemberPrimitives() { 270 Set<OsmPrimitive> ret = new HashSet< OsmPrimitive>();270 Set<OsmPrimitive> ret = new HashSet<>(); 271 271 for (RelationMemberModel rm: members){ 272 272 OsmPrimitive p = layer.data.getPrimitiveById(rm.getTarget()); … … 302 302 public void applyTo(Relation tr){ 303 303 if (tr == null) return; 304 List<RelationMember> newMembers = new ArrayList< RelationMember>();304 List<RelationMember> newMembers = new ArrayList<>(); 305 305 for(RelationMemberModel model: members){ 306 306 RelationMember rm = new RelationMember(model.getRole(), layer.data.getPrimitiveById(model.getTarget())); … … 351 351 352 352 protected List<Integer> getSelectedIndices() { 353 ArrayList<Integer> ret = new ArrayList< Integer>();353 ArrayList<Integer> ret = new ArrayList<>(); 354 354 for(int i =0; i < members.size(); i++){ 355 355 if (rowSelectionModel.isSelectedIndex(i)) … … 416 416 public void insertMembers(Collection<PrimitiveId> ids) throws IllegalArgumentException { 417 417 if (ids == null) return; 418 ArrayList<RelationMemberModel> newMembers = new ArrayList< RelationMemberModel>();418 ArrayList<RelationMemberModel> newMembers = new ArrayList<>(); 419 419 for (PrimitiveId id: ids){ 420 420 OsmPrimitive p = layer.data.getPrimitiveById(id); -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxModel.java
r30454 r30737 23 23 24 24 private TurnRestrictionEditorModel model; 25 final private List<Object> values = new ArrayList< Object>();25 final private List<Object> values = new ArrayList<>(); 26 26 private String selectedTagValue = null; 27 27 private final transient EventListenerList listeners = new EventListenerList(); -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java
r30307 r30737 441 441 */ 442 442 protected List<RelationMember> getDeletedRelationMembers(Relation r) { 443 List<RelationMember> ret = new ArrayList< RelationMember>();443 List<RelationMember> ret = new ArrayList<>(); 444 444 for(RelationMember rm: r.getMembers()) { 445 445 if (rm.getMember().isDeleted() || !rm.getMember().isVisible()) { … … 567 567 Relation toUpdate = new Relation(getTurnRestriction()); 568 568 editorModel.apply(toUpdate); 569 Conflict<Relation> conflict = new Conflict< Relation>(getTurnRestriction(), toUpdate);569 Conflict<Relation> conflict = new Conflict<>(getTurnRestriction(), toUpdate); 570 570 Main.main.undoRedo.add(new ConflictAddCommand(getLayer(),conflict)); 571 571 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorManager.java
r29854 r30737 97 97 98 98 /** the map of open dialogs */ 99 private final HashMap<DialogContext, TurnRestrictionEditor> openDialogs = new HashMap< DialogContext, TurnRestrictionEditor>();99 private final HashMap<DialogContext, TurnRestrictionEditor> openDialogs = new HashMap<>(); 100 100 101 101 /** -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java
r30365 r30737 62 62 63 63 private JLabel lblOsmObject; 64 private final Set<OsmPrimitive> legs = new HashSet< OsmPrimitive>();64 private final Set<OsmPrimitive> legs = new HashSet<>(); 65 65 private TurnRestrictionEditorModel model; 66 66 private TurnRestrictionLegRole role; -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionSelectionPopupPanel.java
r29854 r30737 67 67 */ 68 68 static public Collection<Relation> getTurnRestrictionsParticipatingIn(Collection<OsmPrimitive> primitives){ 69 HashSet<Relation> ret = new HashSet< Relation>();69 HashSet<Relation> ret = new HashSet<>(); 70 70 if (primitives == null) return ret; 71 71 for (OsmPrimitive p: primitives){ … … 296 296 297 297 private static class TurnRestrictionTableModel extends AbstractTableModel { 298 private final ArrayList<Relation> turnrestrictions = new ArrayList< Relation>();298 private final ArrayList<Relation> turnrestrictions = new ArrayList<>(); 299 299 300 300 public TurnRestrictionTableModel(Collection<Relation> turnrestrictions){ -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java
r30454 r30737 21 21 public class TurnRestrictionTypeRenderer extends JLabel implements ListCellRenderer<Object> { 22 22 23 final private Map<TurnRestrictionType, ImageIcon> icons = new HashMap< TurnRestrictionType, ImageIcon>();23 final private Map<TurnRestrictionType, ImageIcon> icons = new HashMap<>(); 24 24 private String iconSet = "set-a"; 25 25 -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListModel.java
r30454 r30737 26 26 27 27 private DefaultListSelectionModel selectionModel; 28 private final ArrayList<OsmPrimitive> vias = new ArrayList< OsmPrimitive>();28 private final ArrayList<OsmPrimitive> vias = new ArrayList<>(); 29 29 private TurnRestrictionEditorModel model; 30 30 … … 52 52 */ 53 53 public List<OsmPrimitive> getSelectedVias() { 54 ArrayList<OsmPrimitive> ret = new ArrayList< OsmPrimitive>();54 ArrayList<OsmPrimitive> ret = new ArrayList<>(); 55 55 for (int i=0; i < getSize(); i++) { 56 56 if (selectionModel.isSelectedIndex(i)) { … … 82 82 */ 83 83 public List<Integer> getSelectedRows() { 84 ArrayList<Integer> ret = new ArrayList< Integer>();84 ArrayList<Integer> ret = new ArrayList<>(); 85 85 for (int i=0; i < getSize(); i++) { 86 86 if (selectionModel.isSelectedIndex(i)) { … … 92 92 93 93 protected List<Integer> moveUp(List<Integer> rows, int targetRow) { 94 List<Integer> ret = new ArrayList< Integer>(rows.size());94 List<Integer> ret = new ArrayList<>(rows.size()); 95 95 int delta = rows.get(0) - targetRow; 96 96 for(int row: rows) { … … 103 103 104 104 protected List<Integer> moveDown(List<Integer> rows, int targetRow) { 105 List<Integer> ret = new ArrayList< Integer>(rows.size());105 List<Integer> ret = new ArrayList<>(rows.size()); 106 106 int delta = targetRow - rows.get(0); 107 107 for(int i = rows.size()-1; i >=0; i--) { … … 170 170 public void insertVias(List<PrimitiveId> idsToInsert) { 171 171 if (idsToInsert == null) return; 172 List<OsmPrimitive> primitives = new ArrayList< OsmPrimitive>(idsToInsert.size());172 List<OsmPrimitive> primitives = new ArrayList<>(idsToInsert.size()); 173 173 DataSet ds = model.getLayer().data; 174 174 for(PrimitiveId id: idsToInsert){ … … 181 181 } 182 182 int targetRow = Math.max(selectionModel.getMinSelectionIndex(),0); 183 List<OsmPrimitive> newVias = new ArrayList< OsmPrimitive>(vias);183 List<OsmPrimitive> newVias = new ArrayList<>(vias); 184 184 newVias.addAll(targetRow, primitives); 185 185 model.setVias(newVias); … … 195 195 */ 196 196 public void removeSelectedVias() { 197 ArrayList<OsmPrimitive> newVias = new ArrayList< OsmPrimitive>(vias);197 ArrayList<OsmPrimitive> newVias = new ArrayList<>(vias); 198 198 int j = 0; 199 199 for(int i=0; i< getSize();i++){ … … 230 230 /* ----------------------------------------------------------------------- */ 231 231 public List<PrimitiveId> getSelectedPrimitiveIds() { 232 ArrayList<PrimitiveId> ids = new ArrayList< PrimitiveId>();232 ArrayList<PrimitiveId> ids = new ArrayList<>(); 233 233 for (OsmPrimitive p: getSelectedVias()) { 234 234 ids.add(p.getPrimitiveId()); -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java
r30454 r30737 43 43 44 44 /** the names of restriction types */ 45 static private Set<String> RESTRICTION_TYPES = new HashSet< String>(45 static private Set<String> RESTRICTION_TYPES = new HashSet<>( 46 46 Arrays.asList(new String[] { 47 47 "no_left_turn", -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetListModel.java
r30145 r30737 47 47 */ 48 48 protected List<Relation> filterTurnRestrictions(Collection<? extends OsmPrimitive> primitives) { 49 List<Relation> ret = new LinkedList< Relation>();49 List<Relation> ret = new LinkedList<>(); 50 50 if (primitives == null) return ret; 51 51 for(OsmPrimitive p: primitives){ … … 64 64 return; 65 65 } 66 List<Relation> turnRestrictions = new LinkedList< Relation>();66 List<Relation> turnRestrictions = new LinkedList<>(); 67 67 for (Relation r: newLayer.data.getRelations()) { 68 68 if (isValid(r) && isTurnRestriction(r)) { -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java
r29854 r30737 32 32 */ 33 33 public void initFromSelection(Collection<? extends OsmPrimitive> selection) { 34 Set<Relation> turnRestrictions = new HashSet< Relation>();34 Set<Relation> turnRestrictions = new HashSet<>(); 35 35 if (selection == null) return; 36 36 for (OsmPrimitive p: selection) { -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java
r30454 r30737 204 204 } 205 205 protected Collection<RelationMember> getMembersForCurrentSelection(Relation r) { 206 Collection<RelationMember> members = new HashSet< RelationMember>();206 Collection<RelationMember> members = new HashSet<>(); 207 207 Collection<OsmPrimitive> selection = Main.main.getEditLayer().data.getSelected(); 208 208 for (RelationMember member: r.getMembers()) { -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListModel.java
r30454 r30737 22 22 */ 23 23 public class TurnRestrictionsListModel extends AbstractListModel<Relation> { 24 private final ArrayList<Relation> turnrestrictions = new ArrayList< Relation>();24 private final ArrayList<Relation> turnrestrictions = new ArrayList<>(); 25 25 private DefaultListSelectionModel selectionModel; 26 26 … … 141 141 public void removeTurnRestrictions(Collection<? extends OsmPrimitive> removedPrimitives) { 142 142 if (removedPrimitives == null) return; 143 Set<Relation> removedTurnRestrictions = new HashSet< Relation>();143 Set<Relation> removedTurnRestrictions = new HashSet<>(); 144 144 for (OsmPrimitive p: removedPrimitives) { 145 145 if (!isTurnRestriction(p)) continue; … … 172 172 */ 173 173 public List<Relation> getSelectedNonNewRelations() { 174 ArrayList<Relation> ret = new ArrayList< Relation>();174 ArrayList<Relation> ret = new ArrayList<>(); 175 175 for (int i=0; i<getSize();i++) { 176 176 if (!selectionModel.isSelectedIndex(i)) { … … 192 192 */ 193 193 public List<Relation> getSelectedTurnRestrictions() { 194 ArrayList<Relation> ret = new ArrayList< Relation>();194 ArrayList<Relation> ret = new ArrayList<>(); 195 195 for (int i=0; i<getSize();i++) { 196 196 if (!selectionModel.isSelectedIndex(i)) { -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Issue.java
r26509 r30737 21 21 protected IssuesModel parent; 22 22 protected Severity severity; 23 protected final ArrayList<Action> actions = new ArrayList< Action>();23 protected final ArrayList<Action> actions = new ArrayList<>(); 24 24 25 25 /** -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesModel.java
r30365 r30737 33 33 */ 34 34 public class IssuesModel extends Observable implements Observer{ 35 private final ArrayList<Issue> issues = new ArrayList< Issue>();35 private final ArrayList<Issue> issues = new ArrayList<>(); 36 36 private TurnRestrictionEditorModel editorModel; 37 37 -
applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java
r30557 r30737 81 81 PrimitiveIdListProvider provider = new PrimitiveIdListProvider() { 82 82 public List<PrimitiveId> getSelectedPrimitiveIds() { 83 List<PrimitiveId> ret = new ArrayList< PrimitiveId>();83 List<PrimitiveId> ret = new ArrayList<>(); 84 84 int [] sel = lstObjects.getSelectedIndices(); 85 85 for (int i: sel){ -
applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java
r30557 r30737 50 50 c.add(pane, gc); 51 51 52 List<Issue> issues = new ArrayList< Issue>();52 List<Issue> issues = new ArrayList<>(); 53 53 issues.add(new RequiredTagMissingError(model, "type", "restriction")); 54 54 issues.add(new MissingRestrictionTypeError(model));
Note:
See TracChangeset
for help on using the changeset viewer.