@Test(expected = ParameterValueException.class) public void invalidDestinationIndexTest() throws StatusCodeException { org.heigit.ors.api.requests.matrix.MatrixRequest springMatrixRequest = new org.heigit.ors.api.requests.matrix.MatrixRequest(new ArrayList<>()); springMatrixRequest.setProfile(APIEnums.Profile.DRIVING_CAR); springMatrixRequest.setLocations(listOfBareCoordinatesList); springMatrixRequest.setSources(new String[]{"all"}); springMatrixRequest.setDestinations(new String[]{"foo"}); MatrixRequestHandler.convertMatrixRequest(springMatrixRequest); }
public static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request) throws StatusCodeException { org.heigit.ors.matrix.MatrixRequest coreRequest = new org.heigit.ors.matrix.MatrixRequest(); int sources = request.getSources() == null ? request.getLocations().size() : request.getSources().length; int destinations = request.getDestinations() == null ? request.getLocations().size() : request.getDestinations().length; Coordinate[] locations = convertLocations(request.getLocations(), sources * destinations); coreRequest.setProfileType(convertToMatrixProfileType(request.getProfile())); if (request.hasMetrics()) coreRequest.setMetrics(convertMetrics(request.getMetrics())); if (request.hasDestinations()) coreRequest.setDestinations(convertDestinations(request.getDestinations(), locations)); else { coreRequest.setDestinations(convertDestinations(new String[]{"all"}, locations)); } if (request.hasSources()) coreRequest.setSources(convertSources(request.getSources(), locations)); else { coreRequest.setSources(convertSources(new String[]{"all"}, locations)); } if (request.hasId()) coreRequest.setId(request.getId()); if (request.hasOptimized()) coreRequest.setFlexibleMode(!request.getOptimized()); if (request.hasResolveLocations()) coreRequest.setResolveLocations(request.getResolveLocations()); if (request.hasUnits()) coreRequest.setUnits(convertUnits(request.getUnits())); return coreRequest; }
MatrixRequestHandler { public static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request) throws StatusCodeException { org.heigit.ors.matrix.MatrixRequest coreRequest = new org.heigit.ors.matrix.MatrixRequest(); int sources = request.getSources() == null ? request.getLocations().size() : request.getSources().length; int destinations = request.getDestinations() == null ? request.getLocations().size() : request.getDestinations().length; Coordinate[] locations = convertLocations(request.getLocations(), sources * destinations); coreRequest.setProfileType(convertToMatrixProfileType(request.getProfile())); if (request.hasMetrics()) coreRequest.setMetrics(convertMetrics(request.getMetrics())); if (request.hasDestinations()) coreRequest.setDestinations(convertDestinations(request.getDestinations(), locations)); else { coreRequest.setDestinations(convertDestinations(new String[]{"all"}, locations)); } if (request.hasSources()) coreRequest.setSources(convertSources(request.getSources(), locations)); else { coreRequest.setSources(convertSources(new String[]{"all"}, locations)); } if (request.hasId()) coreRequest.setId(request.getId()); if (request.hasOptimized()) coreRequest.setFlexibleMode(!request.getOptimized()); if (request.hasResolveLocations()) coreRequest.setResolveLocations(request.getResolveLocations()); if (request.hasUnits()) coreRequest.setUnits(convertUnits(request.getUnits())); return coreRequest; } }
MatrixRequestHandler { public static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request) throws StatusCodeException { org.heigit.ors.matrix.MatrixRequest coreRequest = new org.heigit.ors.matrix.MatrixRequest(); int sources = request.getSources() == null ? request.getLocations().size() : request.getSources().length; int destinations = request.getDestinations() == null ? request.getLocations().size() : request.getDestinations().length; Coordinate[] locations = convertLocations(request.getLocations(), sources * destinations); coreRequest.setProfileType(convertToMatrixProfileType(request.getProfile())); if (request.hasMetrics()) coreRequest.setMetrics(convertMetrics(request.getMetrics())); if (request.hasDestinations()) coreRequest.setDestinations(convertDestinations(request.getDestinations(), locations)); else { coreRequest.setDestinations(convertDestinations(new String[]{"all"}, locations)); } if (request.hasSources()) coreRequest.setSources(convertSources(request.getSources(), locations)); else { coreRequest.setSources(convertSources(new String[]{"all"}, locations)); } if (request.hasId()) coreRequest.setId(request.getId()); if (request.hasOptimized()) coreRequest.setFlexibleMode(!request.getOptimized()); if (request.hasResolveLocations()) coreRequest.setResolveLocations(request.getResolveLocations()); if (request.hasUnits()) coreRequest.setUnits(convertUnits(request.getUnits())); return coreRequest; } private  MatrixRequestHandler(); }
MatrixRequestHandler { public static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request) throws StatusCodeException { org.heigit.ors.matrix.MatrixRequest coreRequest = new org.heigit.ors.matrix.MatrixRequest(); int sources = request.getSources() == null ? request.getLocations().size() : request.getSources().length; int destinations = request.getDestinations() == null ? request.getLocations().size() : request.getDestinations().length; Coordinate[] locations = convertLocations(request.getLocations(), sources * destinations); coreRequest.setProfileType(convertToMatrixProfileType(request.getProfile())); if (request.hasMetrics()) coreRequest.setMetrics(convertMetrics(request.getMetrics())); if (request.hasDestinations()) coreRequest.setDestinations(convertDestinations(request.getDestinations(), locations)); else { coreRequest.setDestinations(convertDestinations(new String[]{"all"}, locations)); } if (request.hasSources()) coreRequest.setSources(convertSources(request.getSources(), locations)); else { coreRequest.setSources(convertSources(new String[]{"all"}, locations)); } if (request.hasId()) coreRequest.setId(request.getId()); if (request.hasOptimized()) coreRequest.setFlexibleMode(!request.getOptimized()); if (request.hasResolveLocations()) coreRequest.setResolveLocations(request.getResolveLocations()); if (request.hasUnits()) coreRequest.setUnits(convertUnits(request.getUnits())); return coreRequest; } private  MatrixRequestHandler(); static MatrixResult generateMatrixFromRequest(MatrixRequest request); static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request); static int convertMetrics(MatrixRequestEnums.Metrics[] metrics); }
MatrixRequestHandler { public static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request) throws StatusCodeException { org.heigit.ors.matrix.MatrixRequest coreRequest = new org.heigit.ors.matrix.MatrixRequest(); int sources = request.getSources() == null ? request.getLocations().size() : request.getSources().length; int destinations = request.getDestinations() == null ? request.getLocations().size() : request.getDestinations().length; Coordinate[] locations = convertLocations(request.getLocations(), sources * destinations); coreRequest.setProfileType(convertToMatrixProfileType(request.getProfile())); if (request.hasMetrics()) coreRequest.setMetrics(convertMetrics(request.getMetrics())); if (request.hasDestinations()) coreRequest.setDestinations(convertDestinations(request.getDestinations(), locations)); else { coreRequest.setDestinations(convertDestinations(new String[]{"all"}, locations)); } if (request.hasSources()) coreRequest.setSources(convertSources(request.getSources(), locations)); else { coreRequest.setSources(convertSources(new String[]{"all"}, locations)); } if (request.hasId()) coreRequest.setId(request.getId()); if (request.hasOptimized()) coreRequest.setFlexibleMode(!request.getOptimized()); if (request.hasResolveLocations()) coreRequest.setResolveLocations(request.getResolveLocations()); if (request.hasUnits()) coreRequest.setUnits(convertUnits(request.getUnits())); return coreRequest; } private  MatrixRequestHandler(); static MatrixResult generateMatrixFromRequest(MatrixRequest request); static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request); static int convertMetrics(MatrixRequestEnums.Metrics[] metrics);  }