Changeset 30737 in osm for applications/editors/josm/plugins/turnlanes
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/CollectionUtils.java
r26154 r30737 37 37 38 38 public static <E> Set<E> toSet(Iterable<? extends E> iterable) { 39 final Set<E> set = new HashSet< E>();39 final Set<E> set = new HashSet<>(); 40 40 41 41 for (E e : iterable) { … … 47 47 48 48 public static <E> List<E> toList(Iterable<? extends E> iterable) { 49 final List<E> list = new ArrayList< E>();49 final List<E> list = new ArrayList<>(); 50 50 51 51 for (E e : iterable) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/GuiContainer.java
r26509 r30737 44 44 private final double laneWidth; 45 45 46 private final Map<Junction, JunctionGui> junctions = new HashMap< Junction, JunctionGui>();47 private final Map<Road, RoadGui> roads = new HashMap< Road, RoadGui>();46 private final Map<Junction, JunctionGui> junctions = new HashMap<>(); 47 private final Map<Road, RoadGui> roads = new HashMap<>(); 48 48 49 49 private final Stroke connectionStroke; … … 159 159 } 160 160 161 final List<Junction> primaries = new ArrayList< Junction>(mc.getPrimaryJunctions());162 final List<Double> top = new ArrayList< Double>();163 final List<Double> left = new ArrayList< Double>();164 final List<Double> right = new ArrayList< Double>();165 final List<Double> bottom = new ArrayList< Double>();161 final List<Junction> primaries = new ArrayList<>(mc.getPrimaryJunctions()); 162 final List<Double> top = new ArrayList<>(); 163 final List<Double> left = new ArrayList<>(); 164 final List<Double> right = new ArrayList<>(); 165 final List<Double> bottom = new ArrayList<>(); 166 166 167 167 for (Junction j : primaries) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/GuiUtil.java
r26154 r30737 133 133 134 134 public static List<Point2D> locs(Iterable<Junction> junctions) { 135 final List<Point2D> locs = new ArrayList< Point2D>();135 final List<Point2D> locs = new ArrayList<>(); 136 136 137 137 for (Junction j : junctions) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/JunctionGui.java
r26154 r30737 296 296 final double y; 297 297 298 private final NavigableMap<Double, Linkage> roads = new TreeMap< Double, Linkage>();298 private final NavigableMap<Double, Linkage> roads = new TreeMap<>(); 299 299 300 300 private final Path2D area = new Path2D.Double(); … … 310 310 this.y = loc.getY(); 311 311 312 final Set<Road> done = new HashSet< Road>();312 final Set<Road> done = new HashSet<>(); 313 313 for (Road r : j.getRoads()) { 314 314 if (!done.contains(r)) { … … 363 363 364 364 private Iterable<Corner> corners() { 365 final List<Corner> result = new ArrayList< JunctionGui.Corner>(roads.size());365 final List<Corner> result = new ArrayList<>(roads.size()); 366 366 367 367 Linkage last = roads.lastEntry().getValue(); … … 396 396 397 397 public Set<RoadGui> getRoads() { 398 final Set<RoadGui> result = new HashSet< RoadGui>();398 final Set<RoadGui> result = new HashSet<>(); 399 399 400 400 for (Linkage l : roads.values()) { … … 435 435 g2d.fill(area); 436 436 437 final List<InteractiveElement> result = new ArrayList< InteractiveElement>();437 final List<InteractiveElement> result = new ArrayList<>(); 438 438 439 439 if (getModel().isPrimary()) { 440 for (Road.End r : new HashSet< Road.End>(getModel().getRoadEnds())) {440 for (Road.End r : new HashSet<>(getModel().getRoadEnds())) { 441 441 for (Turn t : r.getTurns()) { 442 442 result.add(new TurnConnection(t)); -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/JunctionPane.java
r26509 r30737 162 162 private BufferedImage interactive; 163 163 164 private final NavigableMap<Integer, List<InteractiveElement>> interactives = new TreeMap< Integer, List<InteractiveElement>>();164 private final NavigableMap<Integer, List<InteractiveElement>> interactives = new TreeMap<>(); 165 165 private State state; 166 166 private InteractiveElement dragging; … … 423 423 424 424 private List<InteractiveElement> interactives() { 425 final List<InteractiveElement> result = new ArrayList< InteractiveElement>();425 final List<InteractiveElement> result = new ArrayList<>(); 426 426 427 427 for (List<InteractiveElement> ies : interactives.descendingMap().values()) { … … 461 461 final List<InteractiveElement> list; 462 462 if (existing == null) { 463 list = new ArrayList< InteractiveElement>();463 list = new ArrayList<>(); 464 464 interactives.put(ie.getZIndex(), list); 465 465 } else { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/LaneGui.java
r26316 r30737 241 241 } 242 242 243 final List<Road> via = new ArrayList< Road>();243 final List<Road> via = new ArrayList<>(); 244 244 assert (s.getViaConnectors().size() & 1) == 0; 245 245 for (int i = 0; i < s.getViaConnectors().size(); i += 2) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/RoadGui.java
r26154 r30737 249 249 this.end = end; 250 250 251 final List<LaneGui> lanes = new ArrayList< LaneGui>(end.getLanes().size());251 final List<LaneGui> lanes = new ArrayList<>(end.getLanes().size()); 252 252 for (Lane l : end.getOppositeEnd().getLanes()) { 253 253 lanes.add(new LaneGui(RoadGui.this, l)); … … 464 464 465 465 private static final List<Point2D> prepended(List<Point2D> bends, Point2D point) { 466 final List<Point2D> result = new ArrayList< Point2D>(bends.size() + 1);466 final List<Point2D> result = new ArrayList<>(bends.size() + 1); 467 467 result.add(point); 468 468 result.addAll(bends); … … 486 486 487 487 private final Road road; 488 private final List<Segment> segments = new ArrayList< Segment>();488 private final List<Segment> segments = new ArrayList<>(); 489 489 490 490 final double connectorRadius; … … 501 501 this.incomingB = new IncomingConnector(road.getToEnd()); 502 502 503 final List<Point2D> bends = new ArrayList< Point2D>();503 final List<Point2D> bends = new ArrayList<>(); 504 504 final List<Node> nodes = road.getRoute().getNodes(); 505 505 for (int i = nodes.size() - 2; i > 0; --i) { … … 582 582 583 583 List<InteractiveElement> paint(Graphics2D g2d) { 584 final List<InteractiveElement> result = new ArrayList< InteractiveElement>();584 final List<InteractiveElement> result = new ArrayList<>(); 585 585 586 586 result.addAll(paintLanes(g2d)); … … 604 604 605 605 private List<LaneAdder> laneAdders() { 606 final List<LaneAdder> result = new ArrayList< LaneAdder>(4);606 final List<LaneAdder> result = new ArrayList<>(4); 607 607 608 608 if (!incomingA.getLanes().isEmpty()) { … … 624 624 } 625 625 626 final List<Extender> result = new ArrayList< Extender>();626 final List<Extender> result = new ArrayList<>(); 627 627 628 628 final Node n = end.getJunction().getNode(); … … 678 678 g2d.draw(middleLines); 679 679 680 final List<InteractiveElement> result = new ArrayList< InteractiveElement>();680 final List<InteractiveElement> result = new ArrayList<>(); 681 681 682 682 moveIncoming(getModel().getFromEnd()); … … 707 707 708 708 Path innerPath = middle.offset(innerMargin, -1, -1, innerMargin); 709 final List<Path> linePaths = new ArrayList< Path>();709 final List<Path> linePaths = new ArrayList<>(); 710 710 linePaths.add(innerPath); 711 711 … … 867 867 868 868 public List<LaneGui> getLanes() { 869 final List<LaneGui> result = new ArrayList< LaneGui>();869 final List<LaneGui> result = new ArrayList<>(); 870 870 871 871 result.addAll(incomingB.getLanes()); -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/State.java
r26182 r30737 47 47 } 48 48 49 final List<RoadGui.ViaConnector> tmp = new ArrayList< RoadGui.ViaConnector>(vias.size() + 1);49 final List<RoadGui.ViaConnector> tmp = new ArrayList<>(vias.size() + 1); 50 50 final boolean even = (vias.size() & 1) == 0; 51 51 final RoadGui.ViaConnector last = vias.get(vias.size() - 1); -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/TurnLanesDialog.java
r29854 r30737 142 142 private final JToggleButton validateButton = new JToggleButton(validateAction); 143 143 144 private final Set<OsmPrimitive> selected = new HashSet< OsmPrimitive>();144 private final Set<OsmPrimitive> selected = new HashSet<>(); 145 145 146 146 private boolean editing = true; … … 205 205 @Override 206 206 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 207 if (selected.equals(new HashSet< OsmPrimitive>(newSelection))) {207 if (selected.equals(new HashSet<>(newSelection))) { 208 208 return; 209 209 } -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/ValidationPanel.java
r26154 r30737 74 74 75 75 private final DefaultTableModel issueModel = new DefaultTableModel(COLUMN_NAMES, 0); 76 private final List<Issue> issues = new ArrayList< Issue>();76 private final List<Issue> issues = new ArrayList<>(); 77 77 private final JTable issueTable = new JTable(issueModel) { 78 78 private static final long serialVersionUID = 6323348290180585298L; -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/GenericCommand.java
r27890 r30737 34 34 private final DataSet dataSet; 35 35 private final String description; 36 private final Map<OsmPrimitive, BeforeAfter> beforeAfters = new HashMap< OsmPrimitive, BeforeAfter>();36 private final Map<OsmPrimitive, BeforeAfter> beforeAfters = new HashMap<>(); 37 37 38 38 public GenericCommand(DataSet dataSet, String description) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Issue.java
r26154 r30737 49 49 QuickFix quickFix) { 50 50 this.relation = relation; 51 this.primitives = Collections.unmodifiableList(new ArrayList< OsmPrimitive>(primitives));51 this.primitives = Collections.unmodifiableList(new ArrayList<>(primitives)); 52 52 this.severity = severity; 53 53 this.description = description; -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Junction.java
r26192 r30737 13 13 14 14 private final Node node; 15 private final Set<Way> roads = new HashSet< Way>();15 private final Set<Way> roads = new HashSet<>(); 16 16 17 17 Junction(ModelContainer container, Node n) { … … 29 29 30 30 public List<Road> getRoads() { 31 final List<Road> result = new ArrayList< Road>(roads.size());31 final List<Road> result = new ArrayList<>(roads.size()); 32 32 33 33 for (Way w : roads) { … … 39 39 40 40 public List<Road.End> getRoadEnds() { 41 final List<Road.End> result = new ArrayList< Road.End>(roads.size());41 final List<Road.End> result = new ArrayList<>(roads.size()); 42 42 43 43 for (Way w : roads) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Lane.java
r26702 r30737 27 27 28 28 static List<Lane> load(Road.End roadEnd) { 29 final List<Lane> result = new ArrayList< Lane>();29 final List<Lane> result = new ArrayList<>(); 30 30 int i; 31 31 … … 50 50 51 51 static List<Double> loadLengths(Relation r, String key, double lengthBound) { 52 final List<Double> result = new ArrayList< Double>();52 final List<Double> result = new ArrayList<>(); 53 53 54 54 if (r != null && r.get(key) != null) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/ModelContainer.java
r26288 r30737 24 24 25 25 public static ModelContainer create(Iterable<Node> primaryNodes, Iterable<Way> primaryWays) { 26 return new ModelContainer(new HashSet< Node>(CollectionUtils.toList(primaryNodes)), new HashSet<Way>(26 return new ModelContainer(new HashSet<>(CollectionUtils.toList(primaryNodes)), new HashSet<>( 27 27 CollectionUtils.toList(primaryWays)), false); 28 28 } 29 29 30 30 public static ModelContainer createEmpty(Iterable<Node> primaryNodes, Iterable<Way> primaryWays) { 31 return new ModelContainer(new HashSet< Node>(CollectionUtils.toList(primaryNodes)), new HashSet<Way>(31 return new ModelContainer(new HashSet<>(CollectionUtils.toList(primaryNodes)), new HashSet<>( 32 32 CollectionUtils.toList(primaryWays)), true); 33 33 } … … 43 43 closed = true; 44 44 45 for (Node n : new ArrayList< Node>(closedNodes)) {45 for (Node n : new ArrayList<>(closedNodes)) { 46 46 for (Way w : Utils.filterRoads(n.getReferrers())) { 47 47 if (w.isFirstLastNode(n)) { … … 50 50 } 51 51 52 for (Way w : new ArrayList< Way>(closedWays)) {52 for (Way w : new ArrayList<>(closedWays)) { 53 53 closed &= close(closedNodes, closedWays, w); 54 54 } … … 78 78 boolean closed = true; 79 79 80 final List<Way> via = new ArrayList< Way>();80 final List<Way> via = new ArrayList<>(); 81 81 for (RelationMember m : Utils.getMembers(r, Constants.TURN_ROLE_VIA)) { 82 82 if (m.isWay()) { … … 113 113 } 114 114 115 private final Map<Node, Junction> junctions = new HashMap< Node, Junction>();116 private final Map<Way, Road> roads = new HashMap< Way, Road>();115 private final Map<Node, Junction> junctions = new HashMap<>(); 116 private final Map<Way, Road> roads = new HashMap<>(); 117 117 118 118 private final Set<Node> primaryNodes; … … 123 123 private ModelContainer(Set<Node> primaryNodes, Set<Way> primaryWays, boolean empty) { 124 124 if (empty) { 125 this.primaryNodes = Collections.unmodifiableSet(new HashSet< Node>(primaryNodes));126 this.primaryWays = Collections.unmodifiableSet(new HashSet< Way>(primaryWays));125 this.primaryNodes = Collections.unmodifiableSet(new HashSet<>(primaryNodes)); 126 this.primaryWays = Collections.unmodifiableSet(new HashSet<>(primaryWays)); 127 127 this.empty = true; 128 128 } else { 129 final Set<Node> closedNodes = filterUsables(new HashSet< Node>(primaryNodes));130 final Set<Way> closedWays = filterUsables(new HashSet< Way>(primaryWays));129 final Set<Node> closedNodes = filterUsables(new HashSet<>(primaryNodes)); 130 final Set<Way> closedWays = filterUsables(new HashSet<>(primaryWays)); 131 131 132 132 close(closedNodes, closedWays); … … 154 154 155 155 private Set<Pair<Way, Junction>> createPrimaryJunctions() { 156 final Set<Pair<Way, Junction>> roads = new HashSet< Pair<Way, Junction>>();156 final Set<Pair<Way, Junction>> roads = new HashSet<>(); 157 157 158 158 for (Node n : primaryNodes) { 159 final List<Way> ws = new ArrayList< Way>();159 final List<Way> ws = new ArrayList<>(); 160 160 for (Way w : Utils.filterRoads(n.getReferrers())) { 161 161 if (w.isFirstLastNode(n)) { … … 167 167 final Junction j = register(new Junction(this, n)); 168 168 for (Way w : ws) { 169 roads.add(new Pair< Way, Junction>(w, j));169 roads.add(new Pair<>(w, j)); 170 170 } 171 171 } … … 228 228 final String ERR_ILLEGAL_ARGS = "The given roads can not be merged into one."; 229 229 230 final List<Way> ws = new ArrayList< Way>(CollectionUtils.toList(CollectionUtils.reverse(a.getRoute().getWays())));230 final List<Way> ws = new ArrayList<>(CollectionUtils.toList(CollectionUtils.reverse(a.getRoute().getWays()))); 231 231 final List<Way> bws = b.getRoute().getWays(); 232 232 … … 262 262 } 263 263 264 final Set<Junction> pjs = new HashSet< Junction>();264 final Set<Junction> pjs = new HashSet<>(); 265 265 for (Node n : primaryNodes) { 266 266 pjs.add(getJunction(n)); … … 274 274 } 275 275 276 final Set<Road> prs = new HashSet< Road>();276 final Set<Road> prs = new HashSet<>(); 277 277 for (Way w : primaryWays) { 278 278 prs.add(roads.get(w)); -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Road.java
r26192 r30737 245 245 246 246 final double extraLength = left ? extraLengthLeft : extraLengthRight; 247 final List<Double> newLengths = new ArrayList< Double>();247 final List<Double> newLengths = new ArrayList<>(); 248 248 int i = Math.abs(lane.getIndex()); 249 249 final String key = left ? Constants.LENGTHS_KEY_LENGTHS_LEFT : Constants.LENGTHS_KEY_LENGTHS_RIGHT; … … 275 275 276 276 private static Pair<Relation, Relation> getLengthRelations(Way w, Node n) { 277 final List<Relation> left = new ArrayList< Relation>();278 final List<Relation> right = new ArrayList< Relation>();277 final List<Relation> left = new ArrayList<>(); 278 final List<Relation> right = new ArrayList<>(); 279 279 280 280 for (OsmPrimitive p : w.getReferrers()) { … … 307 307 } 308 308 309 return new Pair< Relation, Relation>( //309 return new Pair<>( // 310 310 left.isEmpty() ? null : left.get(0), // 311 311 right.isEmpty() ? null : right.get(0) // -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Route.java
r26154 r30737 135 135 136 136 public static Route create(List<Way> ws, Node end) { 137 final List<Segment> segments = new ArrayList< Segment>(ws.size());137 final List<Segment> segments = new ArrayList<>(ws.size()); 138 138 139 139 for (Way w : ws) { … … 153 153 154 154 private Route(List<Segment> segments) { 155 this.segments = Collections.unmodifiableList(new ArrayList< Segment>(segments));155 this.segments = Collections.unmodifiableList(new ArrayList<>(segments)); 156 156 } 157 157 … … 161 161 162 162 public List<Node> getNodes() { 163 final List<Node> ns = new ArrayList< Node>();163 final List<Node> ns = new ArrayList<>(); 164 164 165 165 ns.add(segments.get(0).getStart()); … … 220 220 221 221 public List<Way> getWays() { 222 final List<Way> ws = new ArrayList< Way>();222 final List<Way> ws = new ArrayList<>(); 223 223 224 224 for (Segment s : segments) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Turn.java
r26288 r30737 21 21 public final class Turn { 22 22 static Set<Turn> load(ModelContainer c, String role, OsmPrimitive primitive) { 23 final Set<Turn> result = new HashSet< Turn>();23 final Set<Turn> result = new HashSet<>(); 24 24 25 25 for (Relation r : OsmPrimitive.getFilteredList(primitive.getReferrers(), Relation.class)) { … … 61 61 62 62 final List<Way> tmp = Utils.getMemberWays(r, Constants.TURN_ROLE_VIA); 63 final LinkedList<Road> via = new LinkedList< Road>();63 final LinkedList<Road> via = new LinkedList<>(); 64 64 65 65 final Road.End fromRoadEnd = c.getJunction(Utils.lineUp(from, tmp.get(0))).getRoadEnd(from); … … 97 97 n = Utils.getOppositeEnd(to, n); 98 98 99 final Set<Turn> result = new HashSet< Turn>();99 final Set<Turn> result = new HashSet<>(); 100 100 for (int i : indices(r, Constants.TURN_KEY_LANES)) { 101 101 result.add(new Turn(r, fromRoadEnd.getLane(Lane.Kind.REGULAR, i), via, toRoadEnd)); … … 111 111 112 112 if (joined == null) { 113 return new ArrayList< Integer>(1);114 } 115 116 final List<Integer> result = new ArrayList< Integer>();113 return new ArrayList<>(1); 114 } 115 116 final List<Integer> result = new ArrayList<>(); 117 117 for (String lane : Constants.SPLIT_PATTERN.split(joined)) { 118 118 result.add(Integer.parseInt(lane)); … … 136 136 final Road.End toRoadEnd = j.getRoadEnd(to); 137 137 138 final Set<Turn> result = new HashSet< Turn>();138 final Set<Turn> result = new HashSet<>(); 139 139 for (int i : indices(r, Constants.TURN_KEY_LANES)) { 140 140 result.add(new Turn(r, fromRoadEnd.getLane(Lane.Kind.REGULAR, i), Collections.<Road> emptyList(), toRoadEnd)); … … 217 217 218 218 void fixReferences(GenericCommand cmd, boolean left, int index) { 219 final List<Integer> fixed = new ArrayList< Integer>();219 final List<Integer> fixed = new ArrayList<>(); 220 220 for (int i : indices(relation, Constants.TURN_KEY_EXTRA_LANES)) { 221 221 if (left ? i < index : i > index) { -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Utils.java
r30043 r30737 20 20 21 21 public class Utils { 22 private static final Set<String> ROAD_HIGHWAY_VALUES = Collections.unmodifiableSet(new HashSet< String>(Arrays22 private static final Set<String> ROAD_HIGHWAY_VALUES = Collections.unmodifiableSet(new HashSet<>(Arrays 23 23 .asList("motorway", "motorway_link", "trunk", "trunk_link", "primary", "primary_link", "secondary", 24 24 "secondary_link", "tertiary", "tertiary_link", "residential", "unclassified", "road", "living_street", "service", … … 30 30 31 31 public static final List<Way> filterRoads(List<OsmPrimitive> of) { 32 final List<Way> result = new ArrayList< Way>();32 final List<Way> result = new ArrayList<>(); 33 33 34 34 for (OsmPrimitive p : of) { … … 70 70 71 71 public static List<RelationMember> getMembers(Relation r, String role) { 72 final List<RelationMember> result = new ArrayList< RelationMember>();72 final List<RelationMember> result = new ArrayList<>(); 73 73 for (RelationMember m : r.getMembers()) { 74 74 if (m.getRole().equals(role)) { … … 88 88 89 89 private static <T> List<T> mapMembers(List<RelationMember> ms, Class<T> t) { 90 final List<T> result = new ArrayList< T>(ms.size());90 final List<T> result = new ArrayList<>(ms.size()); 91 91 for (RelationMember m : ms) { 92 92 result.add(t.cast(m.getMember())); … … 102 102 */ 103 103 public static Node lineUp(Way a, Way b) { 104 final Set<Node> s = new HashSet< Node>(Arrays.asList(a.firstNode(), a.lastNode(), b.firstNode(), b.lastNode()));104 final Set<Node> s = new HashSet<>(Arrays.asList(a.firstNode(), a.lastNode(), b.firstNode(), b.lastNode())); 105 105 if (a.firstNode() == a.lastNode() || b.firstNode().equals(b.lastNode()) || s.size() == 2) { 106 106 throw new IllegalArgumentException("Cycles are not allowed."); … … 152 152 */ 153 153 public static List<Route> orderWays(Iterable<Way> ways, Iterable<Node> nodes) { 154 final List<Way> ws = new LinkedList< Way>(CollectionUtils.toList(ways));155 final Set<Node> ns = new HashSet< Node>(CollectionUtils.toList(nodes));156 157 final List<Route> result = new ArrayList< Route>();154 final List<Way> ws = new LinkedList<>(CollectionUtils.toList(ways)); 155 final Set<Node> ns = new HashSet<>(CollectionUtils.toList(nodes)); 156 157 final List<Route> result = new ArrayList<>(); 158 158 159 159 while (!ws.isEmpty()) { … … 175 175 } 176 176 177 final List<Way> result = new ArrayList< Way>();177 final List<Way> result = new ArrayList<>(); 178 178 result.add(w); 179 179 Node n = first ? w.lastNode() : w.firstNode(); … … 205 205 206 206 public static Iterable<Way> flattenVia(Node start, List<Road> via, Node end) { 207 final List<Way> result = new ArrayList< Way>();207 final List<Way> result = new ArrayList<>(); 208 208 209 209 Node n = start; -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Validator.java
r26288 r30737 105 105 106 106 public List<Issue> validate(DataSet dataSet) { 107 final List<Relation> lenghts = new ArrayList< Relation>();108 final List<Relation> turns = new ArrayList< Relation>();107 final List<Relation> lenghts = new ArrayList<>(); 108 final List<Relation> turns = new ArrayList<>(); 109 109 110 110 for (Relation r : OsmPrimitive.getFilteredList(dataSet.allPrimitives(), Relation.class)) { … … 121 121 } 122 122 123 final List<Issue> issues = new ArrayList< Issue>();124 125 final Map<IncomingLanes.Key, IncomingLanes> incomingLanes = new HashMap< IncomingLanes.Key, IncomingLanes>();123 final List<Issue> issues = new ArrayList<>(); 124 125 final Map<IncomingLanes.Key, IncomingLanes> incomingLanes = new HashMap<>(); 126 126 issues.addAll(validateLengths(lenghts, incomingLanes)); 127 127 issues.addAll(validateTurns(turns, incomingLanes)); … … 138 138 139 139 private List<Issue> validateLengths(List<Relation> lenghts, Map<IncomingLanes.Key, IncomingLanes> incomingLanes) { 140 final List<Issue> issues = new ArrayList< Issue>();140 final List<Issue> issues = new ArrayList<>(); 141 141 142 142 for (Relation r : lenghts) { … … 148 148 149 149 private List<Issue> validateLengths(Relation r, Map<IncomingLanes.Key, IncomingLanes> incomingLanes) { 150 final List<Issue> issues = new ArrayList< Issue>();150 final List<Issue> issues = new ArrayList<>(); 151 151 152 152 try { … … 227 227 228 228 private Route orderWays(final Relation r, List<Way> ways, Node end, List<Issue> issues, String role, String type) { 229 final List<Way> unordered = new ArrayList< Way>(ways);230 final List<Way> ordered = new ArrayList< Way>(ways.size());231 final Set<Node> ends = new HashSet< Node>(); // to find cycles229 final List<Way> unordered = new ArrayList<>(ways); 230 final List<Way> ordered = new ArrayList<>(ways.size()); 231 final Set<Node> ends = new HashSet<>(); // to find cycles 232 232 233 233 Node current = end; … … 280 280 281 281 private List<Issue> validateTurns(List<Relation> turns, Map<IncomingLanes.Key, IncomingLanes> incomingLanes) { 282 final List<Issue> issues = new ArrayList< Issue>();282 final List<Issue> issues = new ArrayList<>(); 283 283 284 284 for (Relation r : turns) { … … 290 290 291 291 private List<Issue> validateTurns(Relation r, Map<IncomingLanes.Key, IncomingLanes> incomingLanes) { 292 final List<Issue> issues = new ArrayList< Issue>();292 final List<Issue> issues = new ArrayList<>(); 293 293 294 294 try { … … 367 367 } 368 368 369 final List<Integer> result = new ArrayList< Integer>();369 final List<Integer> result = new ArrayList<>(); 370 370 371 371 for (String s : Constants.SPLIT_PATTERN.split(ints)) {
Note:
See TracChangeset
for help on using the changeset viewer.