Skip to content

Commit fcd6d29

Browse files
committed
The response mapping is implemented
1 parent 67f7815 commit fcd6d29

File tree

6 files changed

+22
-54
lines changed

6 files changed

+22
-54
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.osrm.client;
22

33
import lombok.Getter;
4-
import lombok.RequiredArgsConstructor;
4+
import lombok.Setter;
55

66
@Getter
7-
@RequiredArgsConstructor
7+
@Setter
88
public class CostMatrices {
9-
private final CostMatrix timeMatrix;
10-
private final CostMatrix distanceMatrix;
9+
private CostMatrix timeMatrix;
10+
private CostMatrix distanceMatrix;
1111
}

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
package com.osrm.client;
22

3+
import lombok.Getter;
4+
import lombok.Setter;
5+
36
import java.util.ArrayList;
47
import java.util.List;
58

9+
@Getter
10+
@Setter
611
public class CostMatrix {
7-
private final int[][] matrix;
8-
9-
public CostMatrix(int size) {
10-
this.matrix = new int[size][size];
11-
}
12-
13-
public void setValueAtCoord(int x, int y, int value) {
14-
this.matrix[x][y] = value;
15-
}
12+
private double[][] matrix;
1613

17-
public int getValueAtCoord(int x, int y) {
14+
public double getValueAtCoord(int x, int y) {
1815
return this.matrix[x][y];
1916
}
2017

@@ -23,7 +20,7 @@ public List<List<Float>> asList() {
2320
for (int x = 0; x < matrix.length; x++) {
2421
List<Float> row = new ArrayList<>();
2522
for (int y = 0; y < matrix.length; y++) {
26-
Float cost = Float.MAX_VALUE;
23+
float cost = Float.MAX_VALUE;
2724
try {
2825
cost = Double.valueOf(matrix[x][y]).floatValue();
2926
} catch (NumberFormatException e) {

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

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.osrm.client;
2+
3+
import com.osrm.client.request.CostMatricesRequest;
4+
5+
6+
public interface CostService {
7+
CostMatrices getCostMatrices(CostMatricesRequest request);
8+
}

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

Lines changed: 0 additions & 33 deletions
This file was deleted.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package com.osrm.client.request;
22

33
import lombok.Builder;
4+
import lombok.Getter;
45

56
import java.util.List;
67

78
@Builder
9+
@Getter
810
public class CostMatricesRequest {
911
private final List<GeoLocation> locations;
1012
private final double speedRate;
1113
private final String country;
1214
private final String token;
1315
private final String profile;
14-
private final String options;
1516
private final String startTime;
1617
private final String vehicleSubType;
1718
private final String restrictionOption;

0 commit comments

Comments
 (0)