-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeasurement.swift
More file actions
executable file
·160 lines (128 loc) · 3.71 KB
/
Measurement.swift
File metadata and controls
executable file
·160 lines (128 loc) · 3.71 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//
// Measurement.swift
// Atmos
//
// Created by Evangelos on 17/01/16.
// Copyright © 2016 Evangelos. All rights reserved.
//
import Foundation
public class Measurement { //setting class properties as private we restrict access only by method calls and thus it's safer
//MARK: Properties
private var userId: String
private var type: String
private var moisture: String
private var temperature: String
private var pressure: String
private var illumination: String
private var magneticField: String
private var proximity: String
private var acceleration: String
private var position: Position
private var duration: String
private var localTimestamp: String
private var serverTimestamp: String
private var source: String
init() {
userId = "default"
type = "measurement"
moisture = "default"
temperature = "default"
pressure = "default"
illumination = "default"
magneticField = "default"
proximity = "default"
acceleration = "default"
position = Position()
duration = "default"
localTimestamp = "default"
serverTimestamp = "default"
source = "default"
//super.init()
}//endInit()
//MARK: Setters
public func setUserId(_userId: String){
userId = _userId
}
public func setType(_type: String) {
type = _type
}
public func setMoisture(_moisture: String) {
moisture = _moisture
}
public func setTemperature(_temperature: String) {
temperature = _temperature
}
public func setPressure(_pressure: String) {
pressure = _pressure
}
public func setIllumination(_illumination: String) {
illumination = _illumination
}
public func setMagneticField(_magneticField: String) {
magneticField = _magneticField
}
public func setProximity(_proximity: String) {
proximity = _proximity
}
public func setAcceleration(_acceleration: String) {
acceleration = _acceleration
}
public func setPosition(_position: Position) {
position = _position
}
public func setDuration(_duration: String) {
duration = _duration
}
public func setLocalTimestamp(_localTimestamp: String) {
localTimestamp = _localTimestamp
}
public func setServerTimestamp(_serverTimestamp: String) {
serverTimestamp = _serverTimestamp
}
public func setSource(_source: String) {
source = _source
}
//MARK: Getters
public func getUserId() -> String {
return userId
}
public func getType() -> String {
return type
}
public func getMoisture() -> String {
return moisture
}
public func getTemperature() -> String {
return temperature
}
public func getPressure() -> String {
return pressure
}
public func getIllumination() -> String {
return illumination
}
public func getMagneticField() -> String {
return magneticField
}
public func getProximity() -> String {
return proximity
}
public func getAcceleration() -> String {
return acceleration
}
public func getPosition() -> Position {
return position
}
public func getDuration() -> String {
return duration
}
public func getLocalTimestamp() -> String {
return localTimestamp
}
public func getServerTimestamp() -> String {
return serverTimestamp
}
public func getSource() -> String {
return source
}
}//endMeasurement.swift