Skip to content

Commit

Permalink
Add copy constructor to ReaderWay
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakaner committed May 13, 2024
1 parent 96b5b0f commit 783f944
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions core/src/main/java/com/graphhopper/reader/ReaderElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ protected ReaderElement(long id, Type type, Map<String, Object> properties) {
this.properties = properties;
}

protected ReaderElement(ReaderElement other) {
this(other.id, other.type, other.properties);
}

public long getId() {
return id;
}
Expand Down
9 changes: 7 additions & 2 deletions core/src/main/java/com/graphhopper/reader/ReaderWay.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@
* @author Nop
*/
public class ReaderWay extends ReaderElement {
protected final LongArrayList nodes = new LongArrayList(5);
protected LongArrayList nodes = new LongArrayList(5);

public ReaderWay(long id) {
super(id, Type.WAY);
}

public LongArrayList getNodes() {
public ReaderWay(ReaderWay other) {
super(other.getId(), other.getType());
this.nodes = other.getNodes();
}

public final LongArrayList getNodes() {
return nodes;
}

Expand Down

0 comments on commit 783f944

Please sign in to comment.