1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use crate::osm::model::coordinate::Coordinate;
use crate::osm::model::tag::Tag;

#[derive(Debug, Clone)]
pub struct Node {
    id: i64,
    version: i32,
    coordinate: Coordinate,
    timestamp: i64,
    changeset: i64,
    uid: i32,
    user: String,
    visible: bool,
    tags: Vec<Tag>,
}

impl Node {
    pub fn new(id: i64, version: i32, coordinate: Coordinate, timestamp: i64, changeset: i64, uid: i32, user: String, visible: bool, tags: Vec<Tag>) -> Node {
        Node {
            id,
            version,
            coordinate,
            timestamp,
            changeset,
            uid,
            user,
            visible,
            tags,
        }
    }

    pub fn id(&self) -> i64 {
        self.id
    }

    pub fn version(&self) -> i32 {
        self.version
    }

    pub fn coordinate(&self) -> &Coordinate {
        &self.coordinate
    }

    pub fn timestamp(&self) -> i64 {
        self.timestamp
    }

    pub fn changeset(&self) -> i64 {
        self.changeset
    }

    pub fn uid(&self) -> i32 {
        self.uid
    }

    pub fn user(&self) -> &String {
        &self.user
    }

    pub fn take_user(&mut self) -> String {
        std::mem::take(&mut self.user)
    }

    pub fn visible(&self) -> bool {
        self.visible.clone()
    }

    pub fn tags(&self) -> &Vec<Tag> {
        &self.tags
    }

    pub fn take_tags(&mut self) -> Vec<Tag> {
        std::mem::take(&mut self.tags)
    }
}