source: josm/trunk/src/org/openstreetmap/josm/data/osm/WayData.java@ 9827

Last change on this file since 9827 was 8415, checked in by Don-vip, 9 years ago

code style/cleanup - Uncommented Empty Constructor

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.util.ArrayList;
5import java.util.List;
6
7import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
8
9public class WayData extends PrimitiveData implements IWay {
10
11 private List<Long> nodes = new ArrayList<>();
12
13 /**
14 * Constructs a new {@code NodeData}.
15 */
16 public WayData() {
17 // contents can be set later with setters
18 }
19
20 /**
21 * Constructs a new {@code WayData}.
22 * @param data way data to copy
23 */
24 public WayData(WayData data) {
25 super(data);
26 nodes.addAll(data.getNodes());
27 }
28
29 public List<Long> getNodes() {
30 return nodes;
31 }
32
33 @Override
34 public int getNodesCount() {
35 return nodes.size();
36 }
37
38 @Override
39 public long getNodeId(int idx) {
40 return nodes.get(idx);
41 }
42
43 @Override
44 public boolean isClosed() {
45 if (isIncomplete()) return false;
46 return nodes.get(0).equals(nodes.get(nodes.size() - 1));
47 }
48
49 public void setNodes(List<Long> nodes) {
50 this.nodes = new ArrayList<>(nodes);
51 }
52
53 @Override
54 public WayData makeCopy() {
55 return new WayData(this);
56 }
57
58 @Override
59 public String toString() {
60 return super.toString() + " WAY" + nodes;
61 }
62
63 @Override
64 public OsmPrimitiveType getType() {
65 return OsmPrimitiveType.WAY;
66 }
67
68 @Override
69 public void accept(PrimitiveVisitor visitor) {
70 visitor.visit(this);
71 }
72
73}
Note: See TracBrowser for help on using the repository browser.