Skip to content

Commit e424fcd

Browse files
committed
A request package is created
1 parent ccd8b95 commit e424fcd

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
package com.osrm.client;public class CostMatrices {
1+
package com.osrm.client;
2+
3+
import lombok.Getter;
4+
import lombok.RequiredArgsConstructor;
5+
6+
@Getter
7+
@RequiredArgsConstructor
8+
public class CostMatrices {
9+
private final CostMatrix timeMatrix;
10+
private final CostMatrix distanceMatrix;
211
}

src/main/java/com/osrm/client/CostMatrix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.List;
55

66
public class CostMatrix {
7-
private int[][] matrix;
7+
private final int[][] matrix;
88

99
public CostMatrix(int size) {
1010
this.matrix = new int[size][size];

src/main/java/com/osrm/client/OSRMCostMatrixResponse.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,17 @@
22

33
import com.google.gson.Gson;
44
import com.google.gson.annotations.SerializedName;
5+
import lombok.Getter;
6+
import lombok.RequiredArgsConstructor;
57

68
import java.util.List;
79

8-
9-
public class OSRMCostMatrixResponse implements CostMatrixResponse {
10-
10+
@Getter
11+
@RequiredArgsConstructor
12+
class OSRMCostMatrixResponse implements CostMatrixResponse {
1113
@SerializedName("matrix")
1214
private final List<List<Integer>> costTable;
1315

14-
public OSRMCostMatrixResponse(List<List<Integer>> costTable) {
15-
this.costTable = costTable;
16-
}
17-
18-
private List<List<Integer>> getCostTable() {
19-
return costTable;
20-
}
21-
2216
public CostMatrix toCostMatrix() {
2317
CostMatrix matrix = new CostMatrix(getCostTable().size());
2418
int i = 0;
@@ -33,7 +27,6 @@ public CostMatrix toCostMatrix() {
3327
return matrix;
3428
}
3529

36-
3730
public static OSRMCostMatrixResponse fromJSON (String json) {
3831
return new Gson().fromJson(json, OSRMCostMatrixResponse.class);
3932
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.osrm.client.request;
2+
3+
import lombok.Builder;
4+
5+
import java.util.List;
6+
7+
@Builder
8+
public class CostMatricesRequest {
9+
private final List<GeoLocation> locations;
10+
private final double speedRate;
11+
private final String country;
12+
private final String token;
13+
private final String profile;
14+
private final String options;
15+
}

src/main/java/com/osrm/client/request/GeoLocation.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
package com.osrm.client;
1+
package com.osrm.client.request;
22

33
import com.google.common.base.Objects;
4+
import lombok.Getter;
5+
import lombok.RequiredArgsConstructor;
46

7+
@Getter
8+
@RequiredArgsConstructor
59
public class GeoLocation {
610
private final Double latitude;
711
private final Double longitude;
812

9-
public GeoLocation (Double latitude, Double longitude) {
10-
this.latitude = latitude;
11-
this.longitude = longitude;
12-
}
13-
14-
public Double getLatitude() {
15-
return this.latitude;
16-
}
17-
18-
public Double getLongitude() {
19-
return this.longitude;
20-
}
21-
2213
public String getLatLongString() {
2314
return this.getLatitude() + "," + this.getLongitude();
2415
}

0 commit comments

Comments
 (0)