-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPoint.java
60 lines (53 loc) · 1.44 KB
/
Point.java
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
public class Point {
public double latitude;
public double longitude;
public long timestamp;
public boolean fake;
public String code;
public Point(double latitude, double longitude, long timestamp){
this.latitude=latitude;
this.longitude=longitude;
this.timestamp=timestamp;
this.fake=false;
}
public Point(double latitude, double longitude){
this.latitude=latitude;
this.longitude=longitude;
this.timestamp=0;
this.fake=false;
}
public Point(double latitude, double longitude, String code){
this.latitude=latitude;
this.longitude=longitude;
this.timestamp=0;
this.fake=false;
this.code=code;
}
public Point(double latitude, double longitude, boolean fake){
this.latitude=latitude;
this.longitude=longitude;
this.timestamp=0;
this.fake=fake;
}
public Point(String line){
String[] elements=line.split(" ");
//
latitude=Double.parseDouble(elements[0]);
longitude=Double.parseDouble(elements[1]);
if(elements.length==3){
timestamp=Long.parseLong(elements[2].substring(0,elements[2].length()-3));
}else{
timestamp=0;
}
fake=false;
}
public Point(String latitude, String longitude){
this.latitude=Double.parseDouble(latitude);
this.longitude=Double.parseDouble(longitude);
}
public String toString(){
String resultString="";
resultString+="{\"latitude\":"+latitude+",\"longitude\":"+longitude+"}";
return resultString;
}
}