src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
LightPauser implements Pauser { public LightPauser(long busyPeriodNS, long parkPeriodNS) { this.busyPeriodNS = busyPeriodNS; this.parkPeriodNS = parkPeriodNS; } LightPauser(long busyPeriodNS, long parkPeriodNS); @Override void reset(); @Override void pause(); void pause(long maxPauseNS); @Override void unpause(); stati...
@Test public void testLightPauser() throws InterruptedException { final LightPauser pauser = new LightPauser(100 * 1000, 100 * 1000); Thread thread = new Thread() { @Override public void run() { while (!Thread.interrupted()) pauser.pause(); } }; thread.start(); for (int t = 0; t < 3; t++) { long start = System.nanoTime...
Maths { public static int intLog2(long num) { long l = Double.doubleToRawLongBits(num); return (int) ((l >> 52) - 1023); } static double round2(double d); static double round4(double d); static double round6(double d); static double round8(double d); static long power10(int n); static int nextPower2(int n, int min); s...
@Test public void testIntLog2() { for (int i = 0; i < 63; i++) { long l = 1L << i; assertEquals(i, Maths.intLog2(l)); } }
HelloWorldController { @RequestMapping("/") public String sayHello() { return "Hello,World!"; } @RequestMapping("/") String sayHello(); @PostMapping(value = "/request_param") String requestParam(@RequestParam(value = "name") String name); @PostMapping(value = "/request_body") UserInfo requestBody(@RequestParam(value =...
@Test public void testSayHello() { assertEquals("Hello,World!",new HelloWorldController().sayHello()); }
OpenhabSseConnection extends SseConnection implements SseConnection.ISseDataListener { @Override protected String buildUrl() { return mUrl + "/rest/events?topics=" + buildTopic(); } OpenhabSseConnection(); void removeItemValueListener(IStateUpdateListener l); @Override void data(String data); }
@Test public void testBuildUrl() { OpenhabSseConnection c = new OpenhabSseConnection(); c.setServerUrl("URL"); c.setItemNames("cmdName"); assertEquals("URL/rest/events?topics=smarthome/items/cmdName/command", c.buildUrl()); c.setItemNames("cmdName","item1", "item2"); assertEquals("URL/rest/events?topics=smarthome/items...
LocalizedFieldNames { public Lookup createLookup(List<String> keys) { return new LookupImpl(keys); } void setMessageSource(MessageSource messageSource); Lookup createLookup(List<String> keys); }
@Test public void backAndForth() { LocalizedFieldNames.Lookup lookup = localizedFieldNames.createLookup(Arrays.asList("dc.title")); final Locale english = new Locale("en"); String title = lookup.toLocalizedName("dc_title", english); Assert.assertEquals("Title", title); String fieldName = lookup.toFieldName(title, engli...
BordersExtractor { public boolean isBorder(int edgeId) { int type = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.TYPE); return (type == BordersGraphStorage.OPEN_BORDER || type == BordersGraphStorage.CONTROLLED_BORDER); } BordersExtractor(BordersGraphStorage storage, int[] avoidCountries); int getValue(int ...
@Test public void TestDetectAnyBorder() { VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); BordersExtractor be = new BordersExtractor(_graphstorage, new int[0]); assertEquals(true, be.isBorder(1)); assertEquals(true, be.isBor...
IsochronesResponse { public BoundingBox getBbox() { return bbox; } IsochronesResponse(IsochronesRequest request); IsochronesResponseInfo getResponseInformation(); BoundingBox getBbox(); }
@Test public void getBbox() { }
GeoJSONIsochronesResponse extends IsochronesResponse { @JsonProperty("features") public List<GeoJSONIsochroneBase> getIsochrones() { return isochroneResults; } GeoJSONIsochronesResponse(IsochronesRequest request, IsochroneMapCollection isoMaps); @JsonProperty("bbox") @JsonInclude(JsonInclude.Include.NON_NULL) @ApiModel...
@Test public void getIsochrones() { }
GeoJSONIsochronesResponse extends IsochronesResponse { @JsonProperty("metadata") public IsochronesResponseInfo getProperties() { return this.responseInformation; } GeoJSONIsochronesResponse(IsochronesRequest request, IsochroneMapCollection isoMaps); @JsonProperty("bbox") @JsonInclude(JsonInclude.Include.NON_NULL) @ApiM...
@Test public void getProperties() { }
GeoJSONIsochroneProperties { public Double getValue() { return value; } GeoJSONIsochroneProperties(Isochrone isochrone, Coordinate center, int groupIndex); int getGroupIndex(); Double getValue(); Double[] getCenter(); Double getArea(); Double getReachfactor(); Double getTotalPop(); }
@Test public void getValue() { }
GeoJSONIsochroneProperties { public Double[] getCenter() { return center; } GeoJSONIsochroneProperties(Isochrone isochrone, Coordinate center, int groupIndex); int getGroupIndex(); Double getValue(); Double[] getCenter(); Double getArea(); Double getReachfactor(); Double getTotalPop(); }
@Test public void getCenter() { }
GeoJSONIsochroneProperties { public Double getArea() { return area; } GeoJSONIsochroneProperties(Isochrone isochrone, Coordinate center, int groupIndex); int getGroupIndex(); Double getValue(); Double[] getCenter(); Double getArea(); Double getReachfactor(); Double getTotalPop(); }
@Test public void getArea() { }
GeoJSONIsochroneProperties { public Double getReachfactor() { return reachfactor; } GeoJSONIsochroneProperties(Isochrone isochrone, Coordinate center, int groupIndex); int getGroupIndex(); Double getValue(); Double[] getCenter(); Double getArea(); Double getReachfactor(); Double getTotalPop(); }
@Test public void getReachfactor() { }
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() : requ...
@Test public void convertMatrixRequestTest() throws StatusCodeException { org.heigit.ors.api.requests.matrix.MatrixRequest springMatrixRequest = new org.heigit.ors.api.requests.matrix.MatrixRequest(bareCoordinates); springMatrixRequest.setProfile(APIEnums.Profile.DRIVING_CAR); springMatrixRequest.setSources(new String[...
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(...
@Test public void TestAvoidSpecificBorders() { _searchParams.setAvoidBorders(BordersExtractor.Avoid.NONE); _searchParams.setAvoidCountries(new int[] {1, 5}); AvoidBordersEdgeFilter filter = new AvoidBordersEdgeFilter(_searchParams, _graphStorage); VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState...
MatrixRequestHandler { public static int convertMetrics(MatrixRequestEnums.Metrics[] metrics) throws ParameterValueException { List<String> metricsAsStrings = new ArrayList<>(); for (int i=0; i<metrics.length; i++) { metricsAsStrings.add(metrics[i].toString()); } String concatMetrics = String.join("|", metricsAsStrings...
@Test public void convertMetricsTest() throws ParameterValueException { Assert.assertEquals(1, MatrixRequestHandler.convertMetrics(new MatrixRequestEnums.Metrics[] {MatrixRequestEnums.Metrics.DURATION})); Assert.assertEquals(2, MatrixRequestHandler.convertMetrics(new MatrixRequestEnums.Metrics[] {MatrixRequestEnums.Met...
MatrixRequestHandler { protected static Coordinate[] convertLocations(List<List<Double>> locations, int numberOfRoutes) throws ParameterValueException, ServerLimitExceededException { if (locations == null || locations.size() < 2) throw new ParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, MatrixRequest....
@Test(expected = ParameterValueException.class) public void notEnoughLocationsTest() throws ParameterValueException, ServerLimitExceededException { MatrixRequestHandler.convertLocations(minimalLocations, 5); } @Test(expected = ServerLimitExceededException.class) public void maximumExceedingLocationsTest() throws Parame...
MatrixRequestHandler { protected static Coordinate convertSingleLocationCoordinate(List<Double> coordinate) throws ParameterValueException { if (coordinate.size() != 2) throw new ParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, MatrixRequest.PARAM_LOCATIONS); return new Coordinate(coordinate.get(0), co...
@Test public void convertSingleLocationCoordinateTest() throws ParameterValueException { List<Double> locationsList = new ArrayList<>(); locationsList.add(8.681495); locationsList.add(49.41461); Coordinate coordinates = MatrixRequestHandler.convertSingleLocationCoordinate(locationsList); Assert.assertEquals(8.681495, c...
MatrixRequestHandler { protected static Coordinate[] convertSources(String[] sourcesIndex, Coordinate[] locations) throws ParameterValueException { int length = sourcesIndex.length; if (length == 0) return locations; if (length == 1 && "all".equalsIgnoreCase(sourcesIndex[0])) return locations; try { ArrayList<Coordinat...
@Test public void convertSourcesTest() throws ParameterValueException { String[] emptySources = new String[0]; Coordinate[] convertedSources = MatrixRequestHandler.convertSources(emptySources, this.coordinates); Assert.assertEquals(8.681495, convertedSources[0].x, 0); Assert.assertEquals(49.41461, convertedSources[0].y...
MatrixRequestHandler { protected static Coordinate[] convertDestinations(String[] destinationsIndex, Coordinate[] locations) throws ParameterValueException { int length = destinationsIndex.length; if (length == 0) return locations; if (length == 1 && "all".equalsIgnoreCase(destinationsIndex[0])) return locations; try {...
@Test public void convertDestinationsTest() throws ParameterValueException { String[] emptyDestinations = new String[0]; Coordinate[] convertedDestinations = MatrixRequestHandler.convertDestinations(emptyDestinations, this.coordinates); Assert.assertEquals(8.681495, convertedDestinations[0].x, 0); Assert.assertEquals(4...
MatrixRequestHandler { protected static ArrayList<Coordinate> convertIndexToLocations(String[] index, Coordinate[] locations) { ArrayList<Coordinate> indexCoordinates = new ArrayList<>(); for (String indexString : index) { int indexInteger = Integer.parseInt(indexString); indexCoordinates.add(locations[indexInteger]); ...
@Test public void convertIndexToLocationsTest() throws Exception { ArrayList<Coordinate> coordinate = MatrixRequestHandler.convertIndexToLocations(new String[]{"1"}, this.coordinates); Assert.assertEquals(8.686507, coordinate.get(0).x, 0); Assert.assertEquals(49.41943, coordinate.get(0).y, 0); Assert.assertEquals(Doubl...
MatrixRequestHandler { protected static DistanceUnit convertUnits(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(MatrixErrorCodes.INVALID_PARAMETE...
@Test public void convertUnitsTest() throws ParameterValueException { Assert.assertEquals(DistanceUnit.METERS, MatrixRequestHandler.convertUnits(APIEnums.Units.METRES)); Assert.assertEquals(DistanceUnit.KILOMETERS, MatrixRequestHandler.convertUnits(APIEnums.Units.KILOMETRES)); Assert.assertEquals(DistanceUnit.MILES, Ma...
MatrixRequestHandler { protected static int convertToMatrixProfileType(APIEnums.Profile profile) throws ParameterValueException { try { int profileFromString = RoutingProfileType.getFromString(profile.toString()); if (profileFromString == 0) { throw new ParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, ...
@Test public void convertToProfileTypeTest() throws ParameterValueException { Assert.assertEquals(1, MatrixRequestHandler.convertToMatrixProfileType(APIEnums.Profile.DRIVING_CAR)); Assert.assertEquals(2, MatrixRequestHandler.convertToMatrixProfileType(APIEnums.Profile.DRIVING_HGV)); Assert.assertEquals(10, MatrixReques...
MatrixRequest { public String getId() { return id; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Profile getProfile(); void setProfile(APIEnums.Profil...
@Test public void getIdTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); Assert.assertNull(matrixLocationsRequest.getId()); Assert.assertNull(matrixLocationsListRequest.getId()); }
MatrixRequest { public void setId(String id) { this.id = id; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Profile getProfile(); void setProfile(APIEn...
@Test public void setIdTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); matrixLocationsRequest.setId("foo1"); matrixLocationsListRequest.setId("foo2"); Assert.assertEquals("foo1", matrixLocatio...
MatrixRequest { public boolean hasId() { return this.id != null; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Profile getProfile(); void setProfile(A...
@Test public void hasIdTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); Assert.assertFalse(matrixLocationsRequest.hasId()); Assert.assertFalse(matrixLocationsListRequest.hasId()); matrixLocatio...
AvoidAreasEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter ) { if (env == null) return true; boolean inEnv = false; PointList pl = iter.fetchWayGeometry(3); int size = pl.getSize(); double eMinX = Double.MAX_VALUE; double eMinY = Double.MAX_VALUE; double eMaxX = Double.MIN...
@Test public void TestAvoidPolygons() { EdgeIteratorState iter1 = _graphStorage.edge(0, 1, 100, true); iter1.setWayGeometry(Helper.createPointList(0, 0, 10, 0)); EdgeIteratorState iter2 = _graphStorage.edge(0, 2, 200, true); iter2.setWayGeometry(Helper.createPointList(0, 0, -10, 0)); GeometryFactory gf = new GeometryFa...
MatrixRequest { public APIEnums.Profile getProfile() { return profile; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Profile getProfile(); void setPro...
@Test public void getProfileTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); Assert.assertNull(matrixLocationsRequest.getProfile()); Assert.assertNull(matrixLocationsListRequest.getProfile()); ...
MatrixRequest { public void setProfile(APIEnums.Profile profile) { this.profile = profile; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Profile getPr...
@Test public void setProfileTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); matrixLocationsRequest.setProfile(APIEnums.Profile.DRIVING_CAR); Assert.assertEquals(APIEnums.Profile.DRIVING_CAR, m...
MatrixRequest { public List<List<Double>> getLocations() { return locations; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Profile getProfile(); void ...
@Test public void getLocationsTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); Assert.assertEquals(listOfBareCoordinatesList, matrixLocationsRequest.getLocations()); Assert.assertEquals(listOfB...
MatrixRequest { public void setLocations(List<List<Double>> locations) { this.locations = locations; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Pro...
@Test public void setLocationsTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); matrixLocationsRequest.setLocations(listOfBareCoordinatesList); matrixLocationsListRequest.setLocations(listOfBare...
MatrixRequest { public void setSources(String[] sources) { this.sources = sources; hasSources = true; } @JsonCreator MatrixRequest(@JsonProperty(value = "locations", required = true) List<List<Double>> locations); MatrixRequest(Double[][] locations); String getId(); void setId(String id); boolean hasId(); APIEnums.Pr...
@Test public void setSourcesTest() throws ParameterValueException { matrixLocationsRequest = new MatrixRequest(bareCoordinates); matrixLocationsListRequest = new MatrixRequest(listOfBareCoordinatesList); matrixLocationsRequest.setSources(new String[]{"foo"}); matrixLocationsListRequest.setSources(new String[]{"foo"}); ...
RouteRequestRoundTripOptions { public void setLength(Float length) { this.length = length; hasLength = true; } Float getLength(); void setLength(Float length); Integer getPoints(); void setPoints(Integer points); Long getSeed(); void setSeed(Long seed); boolean hasLength(); boolean hasPoints(); boolean hasSeed(); stat...
@Test public void testSetLength() { Assert.assertFalse(options.hasLength()); options.setLength(123.4f); Assert.assertTrue(options.hasLength()); Assert.assertEquals((Float)123.4f, options.getLength()); }
RouteRequestRoundTripOptions { public void setPoints(Integer points) { this.points = points; hasPoints = true; } Float getLength(); void setLength(Float length); Integer getPoints(); void setPoints(Integer points); Long getSeed(); void setSeed(Long seed); boolean hasLength(); boolean hasPoints(); boolean hasSeed(); st...
@Test public void testSetPoints() { Assert.assertFalse(options.hasPoints()); options.setPoints(12); Assert.assertTrue(options.hasPoints()); Assert.assertEquals((Integer) 12, options.getPoints()); }
RouteRequestRoundTripOptions { public void setSeed(Long seed) { this.seed = seed; hasSeed = true; } Float getLength(); void setLength(Float length); Integer getPoints(); void setPoints(Integer points); Long getSeed(); void setSeed(Long seed); boolean hasLength(); boolean hasPoints(); boolean hasSeed(); static final St...
@Test public void testSetSeed() { Assert.assertFalse(options.hasSeed()); options.setSeed(1234567890l); Assert.assertTrue(options.hasSeed()); Assert.assertEquals((Long) 1234567890l, options.getSeed()); }
RouteRequestHandler extends GenericHandler { public RoutingRequest convertRouteRequest(RouteRequest request) throws StatusCodeException { RoutingRequest routingRequest = new RoutingRequest(); boolean isRoundTrip = request.hasRouteOptions() && request.getRouteOptions().hasRoundTripOptions(); routingRequest.setCoordinate...
@Test public void convertRouteRequestTest() throws Exception { RoutingRequest routingRequest; routingRequest = new RouteRequestHandler().convertRouteRequest(request); Assert.assertEquals(3, routingRequest.getCoordinates().length); Assert.assertEquals(RoutingProfileType.getFromString("driving-car"), routingRequest.getSe...
ORSGraphHopper extends GraphHopper { public GHResponse constructFreeHandRoute(GHRequest request) { LineString directRouteGeometry = constructFreeHandRouteGeometry(request); PathWrapper directRoutePathWrapper = constructFreeHandRoutePathWrapper(directRouteGeometry); GHResponse directRouteResponse = new GHResponse(); dir...
@Test public void directRouteTest() { GHRequest ghRequest = new GHRequest(49.41281601436809, 8.686215877532959, 49.410163456220076, 8.687160015106201); GHResponse ghResponse = new ORSGraphHopper().constructFreeHandRoute(ghRequest); Assert.assertTrue(ghResponse.getHints().has("skipped_segment")); Assert.assertTrue(ghRes...
BordersGraphStorageBuilder extends AbstractGraphStorageBuilder { @Override public void processWay(ReaderWay way) { LOGGER.warn("Borders requires geometry for the way!"); } BordersGraphStorageBuilder(); @Override GraphExtension init(GraphHopper graphhopper); void setBordersBuilder(CountryBordersReader cbr); @Override vo...
@Test public void TestProcessWay() { ReaderWay rw = new ReaderWay(1); Coordinate[] cs = new Coordinate[] { new Coordinate(0.5,0.5), new Coordinate(1.5,0.5) }; _builder.processWay(rw, cs, null); Assert.assertEquals("c1", rw.getTag("country1")); Assert.assertEquals("c2", rw.getTag("country2")); ReaderWay rw2 = new Reader...
RouteRequest { public boolean hasIncludeRoundaboutExitInfo() { return hasIncludeRoundaboutExitInfo; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId...
@Test public void testHasIncludeRoundaboutExitInfo() { request.setIncludeRoundaboutExitInfo(true); Assert.assertTrue(request.hasIncludeRoundaboutExitInfo()); }
RouteRequest { public boolean hasAttributes() { return hasAttributes; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(String id); boo...
@Test public void testHasAttributes() { request.setAttributes(new APIEnums.Attributes[] {APIEnums.Attributes.AVERAGE_SPEED}); Assert.assertTrue(request.hasAttributes()); }
RouteRequest { public boolean hasMaximumSearchRadii() { return hasMaximumSearchRadii; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId...
@Test public void testHasMaximumSearchRadii() { request.setMaximumSearchRadii(new Double[] { 1.0 }); Assert.assertTrue(request.hasMaximumSearchRadii()); }
BordersGraphStorageBuilder extends AbstractGraphStorageBuilder { public String[] findBorderCrossing(Coordinate[] coords) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); boolean hasInternational = false; boolean overlap = false; int lsLen = coords.length; if(lsLen > 1) { for(int i=0; i<lsLen; i++) { Co...
@Test public void TestFindBorderCrossing() { String[] names = _builder.findBorderCrossing(new Coordinate[] { new Coordinate(0.5,0.5), new Coordinate(1.5,0.5) }); Assert.assertEquals(2, names.length); Assert.assertTrue(names[0].equals("c1") || names[1].equals("c1")); Assert.assertTrue(names[0].equals("c2") || names[1].e...
RouteRequest { public boolean hasBearings() { return hasBearings; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(String id); boolean...
@Test public void testHasBearings() { request.setBearings(new Double[][] {new Double[] {0.0, 90.0}}); Assert.assertTrue(request.hasBearings()); }
RouteRequest { public boolean hasUseElevation() { return hasUseElevation; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(String id);...
@Test public void testHasUseElevation() { request.setUseElevation(true); Assert.assertTrue(request.hasUseElevation()); }
RouteRequest { public boolean hasRouteOptions() { return hasRouteOptions; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(String id);...
@Test public void testHasRouteOptions() { request.setRouteOptions(new RouteRequestOptions()); Assert.assertTrue(request.hasRouteOptions()); }
RouteRequest { public boolean hasUseContractionHierarchies() { return hasUseContractionHierarchies; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId...
@Test public void testHasUseContractionHierarchies() { request.setUseContractionHierarchies(true); Assert.assertTrue(request.hasUseContractionHierarchies()); }
RouteRequest { public boolean hasExtraInfo() { return hasExtraInfo; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(String id); boole...
@Test public void testHasExtraInfo() { request.setExtraInfo(new APIEnums.ExtraInfo[] { APIEnums.ExtraInfo.SURFACE }); Assert.assertTrue(request.hasExtraInfo()); }
RouteRequest { public boolean hasSuppressWarnings() { return hasSuppressWarnings; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(Str...
@Test public void testHasSuppressWarnings() { request.setSuppressWarnings(true); Assert.assertTrue(request.hasSuppressWarnings()); }
RouteRequest { public boolean hasSkipSegments() { return hasSkipSegments;} @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(String id); ...
@Test public void testHasSkipSegments() { List<Integer> testSegments = new ArrayList<>(); testSegments.add(0, 1); Assert.assertFalse(request.hasSkipSegments()); request.setSkipSegments(testSegments); Assert.assertTrue(request.hasSkipSegments()); }
RouteRequest { public boolean hasAlternativeRoutes() { return hasAlternativeRoutes; } @JsonCreator RouteRequest(@JsonProperty(value = PARAM_COORDINATES, required = true) List<List<Double>> coordinates); RouteRequest(Double[][] coordinates); RouteRequest(Coordinate start, Coordinate end); String getId(); void setId(S...
@Test public void testHasAlternativeRoutes() { RouteRequestAlternativeRoutes ar = new RouteRequestAlternativeRoutes(); Assert.assertFalse(request.hasAlternativeRoutes()); request.setAlternativeRoutes(ar); Assert.assertTrue(request.hasAlternativeRoutes()); }
IsochronesRequest { public String getId() { return id; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing); boolean hasSmoo...
@Test public void getIdTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getId()); }
IsochronesRequest { public void setId(String id) { this.id = id; this.hasId = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Doubl...
@Test public void setIdTest() { IsochronesRequest request = new IsochronesRequest(); request.setId("foo"); Assert.assertEquals("foo", request.getId()); }
IsochronesRequest { public boolean hasId() { return hasId; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing); boolean has...
@Test public void hasIdTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertFalse(request.hasId()); request.setId("foo"); Assert.assertTrue(request.hasId()); }
IsochronesRequest { public void setAreaUnit(APIEnums.Units areaUnit) { this.areaUnit = areaUnit; hasAreaUnits = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSm...
@Test public void setAreaUnitTest() throws ParameterValueException { IsochronesRequest request = new IsochronesRequest(); request.setAreaUnit(APIEnums.Units.forValue("km")); Assert.assertEquals(APIEnums.Units.KILOMETRES, request.getAreaUnit()); }
IsochronesRequest { public Double getSmoothing() { return smoothing; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing); b...
@Test public void getSmoothingTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getSmoothing()); }
IsochronesRequest { public void setSmoothing(Double smoothing) { this.smoothing = smoothing; this.hasSmoothing = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getS...
@Test public void setSmoothingTest() { IsochronesRequest request = new IsochronesRequest(); request.setSmoothing(0.1); Assert.assertEquals(0.1, request.getSmoothing(), 0); }
IsochronesRequest { public boolean hasSmoothing() { return hasSmoothing; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing...
@Test public void hasSmoothingTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertFalse(request.hasSmoothing()); request.setSmoothing(0.1); Assert.assertTrue(request.hasSmoothing()); }
IsochronesRequest { public APIEnums.RouteResponseType getResponseType() { return responseType; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoo...
@Test public void getResponseTypeTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertEquals(APIEnums.RouteResponseType.GEOJSON, request.getResponseType()); }
IsochronesRequest { public void setResponseType(APIEnums.RouteResponseType responseType) { this.responseType = responseType; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Doubl...
@Test public void setResponseTypeTest() { IsochronesRequest request = new IsochronesRequest(); request.setResponseType(APIEnums.RouteResponseType.JSON); Assert.assertEquals(APIEnums.RouteResponseType.JSON, request.getResponseType()); }
IsochronesRequest { public IsochronesRequestEnums.Attributes[] getAttributes() { return attributes; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void se...
@Test public void getAttributesTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getAttributes()); }
IsochronesRequest { public Double[][] getLocations() { return locations; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing...
@Test public void getLocationTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertEquals(Double[][].class, request.getLocations().getClass()); }
IsochronesRequest { public void setLocationType(IsochronesRequestEnums.LocationType locationType) { this.locationType = locationType; hasLocationType = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUni...
@Test public void setLocationTypeTest() { IsochronesRequest request = new IsochronesRequest(); request.setLocationType(IsochronesRequestEnums.LocationType.DESTINATION); Assert.assertEquals(IsochronesRequestEnums.LocationType.DESTINATION, request.getLocationType()); }
WheelchairSidewalkWay extends PedestrianWay { @Override public boolean hasWayBeenFullyProcessed() { if(side == OSMAttachedSidewalkProcessor.Side.BOTH && lastPrepared == OSMAttachedSidewalkProcessor.Side.RIGHT) { return true; } return side == lastPrepared; } WheelchairSidewalkWay(ReaderWay way); @Override boolean hasWay...
@Test public void TestInitiallyProcessedIfNoSidewalk() { WheelchairSidewalkWay way = new WheelchairSidewalkWay(new ReaderWay(1)); assertTrue(way.hasWayBeenFullyProcessed()); } @Test public void TestInitiallyNotProcessedIfSidewalk() { ReaderWay readerWay = new ReaderWay(1); readerWay.setTag("sidewalk", "left"); Wheelcha...
IsochronesRequest { public APIEnums.Profile getProfile() { return profile; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothi...
@Test public void getProfileTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getProfile()); }
IsochronesRequest { public void setProfile(APIEnums.Profile profile) { this.profile = profile; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoo...
@Test public void setProfileTest() { IsochronesRequest request = new IsochronesRequest(); request.setProfile(APIEnums.Profile.DRIVING_CAR); Assert.assertEquals(APIEnums.Profile.DRIVING_CAR, request.getProfile()); }
IsochronesRequest { public RouteRequestOptions getIsochronesOptions() { return isochronesOptions; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setS...
@Test public void getIsochronesOptionsTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getIsochronesOptions()); }
IsochronesRequest { public void setIsochronesOptions(RouteRequestOptions isochronesOptions) { this.isochronesOptions = isochronesOptions; this.hasOptions = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units are...
@Test public void setIsochronesOptionsTest() { IsochronesRequest request = new IsochronesRequest(); request.setIsochronesOptions(new RouteRequestOptions()); Assert.assertEquals(RouteRequestOptions.class, request.getIsochronesOptions().getClass()); }
IsochronesRequest { public List<Double> getRange() { return range; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing); boo...
@Test public void getRangeTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getRange()); }
IsochronesRequest { public void setRange(List<Double> range) { this.range = range; hasRange = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void se...
@Test public void setRangeTest() { IsochronesRequest request = new IsochronesRequest(); request.setRange(new ArrayList<>()); Assert.assertNotNull(request.getRange()); }
IsochronesRequest { public void setRangeType(IsochronesRequestEnums.RangeType rangeType) { this.rangeType = rangeType; hasRangeType = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAre...
@Test public void setRangeTypeTest() { IsochronesRequest request = new IsochronesRequest(); request.setRangeType(IsochronesRequestEnums.RangeType.DISTANCE); Assert.assertEquals(IsochronesRequestEnums.RangeType.DISTANCE, request.getRangeType()); }
IsochronesRequest { public Double getInterval() { return interval; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing(); void setSmoothing(Double smoothing); boo...
@Test public void getIntervalTest() { IsochronesRequest request = new IsochronesRequest(); Assert.assertNull(request.getInterval()); }
IsochronesRequest { public void setInterval(Double interval) { this.interval = interval; hasInterval = true; } @JsonCreator IsochronesRequest(); String getId(); void setId(String id); boolean hasId(); APIEnums.Units getAreaUnit(); void setAreaUnit(APIEnums.Units areaUnit); boolean hasAreaUnits(); Double getSmoothing()...
@Test public void setIntervalTest() { IsochronesRequest request = new IsochronesRequest(); request.setInterval(new Double("0.0")); Assert.assertEquals(new Double("0.0"), request.getInterval()); }
IsochronesRequestHandler extends GenericHandler { Float convertSmoothing(Double smoothingValue) throws ParameterValueException { float f = (float) smoothingValue.doubleValue(); if (smoothingValue < 0 || smoothingValue > 100) throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesReque...
@Test public void convertSmoothing() throws ParameterValueException { Float smoothing = handler.convertSmoothing(10.234); Assert.assertEquals(10.234, smoothing, 0.01); } @Test(expected = ParameterValueException.class) public void convertSmoothingFailWhenTooHigh() throws ParameterValueException { handler.convertSmoothin...
IsochronesRequestHandler extends GenericHandler { String convertLocationType(IsochronesRequestEnums.LocationType locationType) throws ParameterValueException { IsochronesRequestEnums.LocationType value; switch (locationType) { case DESTINATION: value = IsochronesRequestEnums.LocationType.DESTINATION; break; case START:...
@Test public void convertLocationType() throws ParameterValueException { String locationType = handler.convertLocationType(IsochronesRequestEnums.LocationType.DESTINATION); Assert.assertEquals("destination", locationType); locationType = handler.convertLocationType(IsochronesRequestEnums.LocationType.START); Assert.ass...
IsochronesRequestHandler extends GenericHandler { TravelRangeType convertRangeType(IsochronesRequestEnums.RangeType rangeType) throws ParameterValueException { TravelRangeType travelRangeType; switch (rangeType) { case DISTANCE: travelRangeType = TravelRangeType.DISTANCE; break; case TIME: travelRangeType = TravelRange...
@Test public void convertRangeType() throws ParameterValueException { TravelRangeType rangeType = handler.convertRangeType(IsochronesRequestEnums.RangeType.DISTANCE); Assert.assertEquals(TravelRangeType.DISTANCE, rangeType); rangeType = handler.convertRangeType(IsochronesRequestEnums.RangeType.TIME); Assert.assertEqual...
IsochronesRequestHandler extends GenericHandler { String convertAreaUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit areaUnit; try { areaUnit = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (areaUnit == DistanceUnit.UNKNOWN) throw new ParameterValueException(Isoc...
@Test public void convertAreaUnit() throws ParameterValueException { String unit = handler.convertAreaUnit(APIEnums.Units.KILOMETRES); Assert.assertEquals("km", unit); unit = handler.convertAreaUnit(APIEnums.Units.METRES); Assert.assertEquals("m", unit); unit = handler.convertAreaUnit(APIEnums.Units.MILES); Assert.asse...
IsochronesRequestHandler extends GenericHandler { String convertRangeUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units; try { units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(IsochronesEr...
@Test public void convertRangeUnit() throws ParameterValueException { String unit = handler.convertRangeUnit(APIEnums.Units.KILOMETRES); Assert.assertEquals("km", unit); unit = handler.convertRangeUnit(APIEnums.Units.METRES); Assert.assertEquals("m", unit); unit = handler.convertRangeUnit(APIEnums.Units.MILES); Assert....
IsochronesRequestHandler extends GenericHandler { Coordinate convertSingleCoordinate(Double[] coordinate) throws ParameterValueException { Coordinate realCoordinate; if (coordinate.length != 2) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_LOCATIONS); } try { ...
@Test public void convertSingleCoordinate() throws ParameterValueException { Coordinate coord = handler.convertSingleCoordinate(new Double[]{123.4, 321.0}); Assert.assertEquals(123.4, coord.x, 0.0001); Assert.assertEquals(321.0, coord.y, 0.0001); } @Test(expected = ParameterValueException.class) public void convertSing...
IsochronesRequestHandler extends GenericHandler { void setRangeAndIntervals(TravellerInfo travellerInfo, List<Double> rangeValues, Double intervalValue) throws ParameterValueException { double rangeValue = -1; if (rangeValues.size() == 1) { try { rangeValue = rangeValues.get(0); travellerInfo.setRanges(new double[]{ran...
@Test public void setRangeAndIntervals() throws ParameterValueException { TravellerInfo info = new TravellerInfo(); List<Double> rangeValues = new ArrayList<>(); rangeValues.add(20.0); double intervalValue = 10; handler.setRangeAndIntervals(info, rangeValues, intervalValue); Assert.assertEquals(10.0, info.getRanges()[0...
WheelchairSeparateWay extends PedestrianWay { @Override public boolean hasWayBeenFullyProcessed() { return hasBeenProcessed; } WheelchairSeparateWay(ReaderWay way); @Override boolean hasWayBeenFullyProcessed(); @Override void prepare(); }
@Test public void TestInitiallyNotProcessed() { assertFalse(way.hasWayBeenFullyProcessed()); }
BordersExtractor { public boolean isControlledBorder(int edgeId) { return storage.getEdgeValue(edgeId, BordersGraphStorage.Property.TYPE) == BordersGraphStorage.CONTROLLED_BORDER; } BordersExtractor(BordersGraphStorage storage, int[] avoidCountries); int getValue(int edgeId); boolean isBorder(int edgeId); boolean isCon...
@Test public void TestDetectControlledBorder() { VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); BordersExtractor be = new BordersExtractor(_graphstorage, new int[0]); assertEquals(true, be.isControlledBorder(1)); assertEqua...
IsochronesRequestHandler extends GenericHandler { String[] convertAttributes(IsochronesRequestEnums.Attributes[] attributes) { return convertAPIEnumListToStrings(attributes); } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneReques...
@Test public void convertAttributes() { IsochronesRequestEnums.Attributes[] atts = new IsochronesRequestEnums.Attributes[]{IsochronesRequestEnums.Attributes.AREA, IsochronesRequestEnums.Attributes.REACH_FACTOR, IsochronesRequestEnums.Attributes.TOTAL_POPULATION}; String[] attStr = handler.convertAttributes(atts); Asser...
IsochronesRequestHandler extends GenericHandler { String convertCalcMethod(IsochronesRequestEnums.CalculationMethod bareCalcMethod) throws ParameterValueException { try { switch (bareCalcMethod) { case CONCAVE_BALLS: return "concaveballs"; case GRID: return "grid"; case FASTISOCHRONE: return "fastisochrone"; default: r...
@Test public void convertCalcMethod() throws ParameterValueException { String calcMethod = handler.convertCalcMethod(IsochronesRequestEnums.CalculationMethod.CONCAVE_BALLS); Assert.assertEquals("concaveballs", calcMethod); calcMethod = handler.convertCalcMethod(IsochronesRequestEnums.CalculationMethod.GRID); Assert.ass...
IsochronesRequestHandler extends GenericHandler { IsochroneRequest convertIsochroneRequest(IsochronesRequest request) throws Exception { IsochroneRequest convertedIsochroneRequest = new IsochroneRequest(); Double[][] locations = request.getLocations(); for (int i = 0; i < request.getLocations().length; i++) { Double[] ...
@Test public void convertIsochroneRequest() throws Exception { IsochronesRequest request = new IsochronesRequest(); Double[][] locations = {{9.676034, 50.409675}, {9.676034, 50.409675}}; Coordinate coord0 = new Coordinate(); coord0.x = 9.676034; coord0.y = 50.409675; request.setLocations(locations); request.setProfile(...
IsochronesRequestHandler extends GenericHandler { TravellerInfo constructTravellerInfo(Double[] coordinate, IsochronesRequest request) throws Exception { TravellerInfo travellerInfo = new TravellerInfo(); RouteSearchParameters routeSearchParameters = constructRouteSearchParameters(request); travellerInfo.setRouteSearch...
@Test public void constructTravellerInfo() throws Exception { Double[][] coordinates = {{1.0, 3.0}, {1.0, 3.0}}; Double[] coordinate = {1.0, 3.0}; Coordinate realCoordinate = new Coordinate(); realCoordinate.x = 1.0; realCoordinate.y = 3.0; IsochronesRequest request = new IsochronesRequest(); request.setProfile(APIEnum...
IsochronesRequestHandler extends GenericHandler { RouteSearchParameters constructRouteSearchParameters(IsochronesRequest request) throws Exception { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); int profileType; try { profileType = convertToIsochronesProfileType(request.getProfile()); } cat...
@Test public void constructRouteSearchParametersTest() throws Exception { Double[][] coordinates = {{1.0, 3.0}, {1.0, 3.0}}; IsochronesRequestHandler isochronesRequestHandler = new IsochronesRequestHandler(); IsochronesRequest request = new IsochronesRequest(); request.setProfile(APIEnums.Profile.DRIVING_CAR); request....
IsochronesRequestHandler extends GenericHandler { RouteSearchParameters processIsochronesRequestOptions(IsochronesRequest request, RouteSearchParameters parameters) throws StatusCodeException { RouteRequestOptions options = request.getIsochronesOptions(); parameters = new RouteRequestHandler().processRequestOptions(opt...
@Test public void processIsochronesRequestOptionsTest() throws Exception { IsochronesRequestHandler isochronesRequestHandler = new IsochronesRequestHandler(); RouteSearchParameters routeSearchParameters = isochronesRequestHandler.constructRouteSearchParameters(request); Assert.assertEquals(RoutingProfileType.DRIVING_CA...
IsochronesRequestHandler extends GenericHandler { public IsochroneMapCollection getIsoMaps() { return isoMaps; } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest(); }
@Test public void getIsoMapsTest() { IsochronesRequestHandler isochronesRequestHandler = new IsochronesRequestHandler(); Assert.assertNull(isochronesRequestHandler.getIsoMaps()); }
IsochronesRequestHandler extends GenericHandler { public IsochroneRequest getIsochroneRequest() { return isochroneRequest; } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest(); }
@Test public void getIsochroneRequestTest() { IsochronesRequestHandler isochronesRequestHandler = new IsochronesRequestHandler(); Assert.assertNull(isochronesRequestHandler.getIsochroneRequest()); }
GenericHandler { protected String[] convertAPIEnumListToStrings(Enum[] valuesIn) { String[] attributes = new String[valuesIn.length]; for (int i = 0; i < valuesIn.length; i++) { attributes[i] = convertAPIEnum(valuesIn[i]); } return attributes; } GenericHandler(); static final String KEY_PROFILE; }
@Test public void convertAPIEnumListToStrings() { String[] strVals = handler.convertAPIEnumListToStrings(new APIEnums.ExtraInfo[] {APIEnums.ExtraInfo.STEEPNESS, APIEnums.ExtraInfo.SURFACE}); Assert.assertEquals(2, strVals.length); Assert.assertEquals("steepness", strVals[0]); Assert.assertEquals("surface", strVals[1]);...
GenericHandler { protected String convertAPIEnum(Enum valuesIn) { return valuesIn.toString(); } GenericHandler(); static final String KEY_PROFILE; }
@Test public void convertAPIEnum() { String strVal = handler.convertAPIEnum(APIEnums.AvoidBorders.CONTROLLED); Assert.assertEquals("controlled", strVal); }
OSMAttachedSidewalkProcessor { protected boolean hasSidewalkInfo(ReaderWay way) { return identifySidesWhereSidewalkIsPresent(way) != Side.NONE; } ReaderWay attachSidewalkTag(ReaderWay way, Side side); Side getPreparedSide(ReaderWay way); static final String KEY_ORS_SIDEWALK_SIDE; static final String VAL_RIGHT; static ...
@Test public void TestDetectSidewalkInfoFromTags() { ReaderWay way = new ReaderWay(1); way.setTag("sidewalk:left:surface", "asphalt"); assertTrue(processor.hasSidewalkInfo(way)); way = new ReaderWay(1); way.setTag("footway:right:width", "0.5"); assertTrue(processor.hasSidewalkInfo(way)); way = new ReaderWay(1); assertF...
GenericHandler { protected int convertVehicleType(APIEnums.VehicleType vehicleTypeIn, int profileType) throws IncompatibleParameterException { if (!RoutingProfileType.isHeavyVehicle(profileType)) { throw new IncompatibleParameterException(getInvalidParameterValueErrorCode(), "vehicle_type", vehicleTypeIn.toString(), KE...
@Test public void convertVehicleType() throws IncompatibleParameterException { int type = handler.convertVehicleType(APIEnums.VehicleType.HGV, 2); Assert.assertEquals(2, type); } @Test(expected = IncompatibleParameterException.class) public void convertVehicleTypeError() throws IncompatibleParameterException { handler....
GenericHandler { protected BordersExtractor.Avoid convertAvoidBorders(APIEnums.AvoidBorders avoidBorders) { if (avoidBorders != null) { switch (avoidBorders) { case ALL: return BordersExtractor.Avoid.ALL; case CONTROLLED: return BordersExtractor.Avoid.CONTROLLED; default: return BordersExtractor.Avoid.NONE; } } return ...
@Test public void convertAvoidBorders() { BordersExtractor.Avoid avoid = handler.convertAvoidBorders(APIEnums.AvoidBorders.CONTROLLED); Assert.assertEquals(BordersExtractor.Avoid.CONTROLLED, avoid); avoid = handler.convertAvoidBorders(APIEnums.AvoidBorders.ALL); Assert.assertEquals(BordersExtractor.Avoid.ALL, avoid); a...
GenericHandler { protected int convertRouteProfileType(APIEnums.Profile profile) { return RoutingProfileType.getFromString(profile.toString()); } GenericHandler(); static final String KEY_PROFILE; }
@Test public void convertRouteProfileType() { int type = handler.convertRouteProfileType(APIEnums.Profile.DRIVING_CAR); Assert.assertEquals(1, type); type = handler.convertRouteProfileType(APIEnums.Profile.FOOT_WALKING); Assert.assertEquals(20, type); }
GenericHandler { protected Polygon[] convertAvoidAreas(JSONObject geoJson, int profileType) throws StatusCodeException { org.json.JSONObject complexJson = new org.json.JSONObject(); complexJson.put("type", geoJson.get("type")); List<List<Double[]>> coordinates = (List<List<Double[]>>) geoJson.get("coordinates"); comple...
@Test public void convertAvoidAreas() throws StatusCodeException { JSONObject geomJSON = new JSONObject(); geomJSON.put("type", "Polygon"); JSONArray poly = generateGeoJSONPolyCoords(); JSONArray coords = new JSONArray(); coords.add(0, poly); geomJSON.put("coordinates", coords); Polygon[] avoidAreas = handler.convertAv...
GenericHandler { protected int convertFeatureTypes(APIEnums.AvoidFeatures[] avoidFeatures, int profileType) throws UnknownParameterValueException, IncompatibleParameterException { int flags = 0; for (APIEnums.AvoidFeatures avoid : avoidFeatures) { String avoidFeatureName = avoid.toString(); int flag = AvoidFeatureFlags...
@Test public void convertFeatureTypes() throws UnknownParameterValueException, IncompatibleParameterException { APIEnums.AvoidFeatures[] avoids = new APIEnums.AvoidFeatures[] { APIEnums.AvoidFeatures.FERRIES, APIEnums.AvoidFeatures.FORDS }; int converted = handler.convertFeatureTypes(avoids, 1); Assert.assertEquals(24,...
GenericHandler { protected ProfileParameters convertParameters(RouteRequestOptions options, int profileType) throws StatusCodeException { ProfileParameters params = new ProfileParameters(); if (options.getProfileParams().hasRestrictions()) { RequestProfileParamsRestrictions restrictions = options.getProfileParams().get...
@Test public void convertParameters() throws StatusCodeException { RouteRequestOptions opts = new RouteRequestOptions(); RequestProfileParams params = new RequestProfileParams(); RequestProfileParamsRestrictions restrictions = new RequestProfileParamsRestrictions(); restrictions.setHeight(10.0f); params.setRestrictions...
OSMAttachedSidewalkProcessor { protected Side identifySidesWhereSidewalkIsPresent(ReaderWay osmWay) { boolean sidewalkOnLeftSide = false; boolean sidewalkOnRightSide = false; boolean sidewalkOnBothSides = false; if(osmWay.hasTag("sidewalk")) { String side = osmWay.getTag("sidewalk"); switch(side) { case VAL_LEFT: sidew...
@Test public void TestIdentificationOfSidesWithSidewalkInfo() { ReaderWay way = new ReaderWay(1); way.setTag("sidewalk:left:surface", "asphalt"); assertEquals(OSMAttachedSidewalkProcessor.Side.LEFT, processor.identifySidesWhereSidewalkIsPresent(way)); way = new ReaderWay(1); way.setTag("sidewalk", "both"); assertEquals...
GenericHandler { protected ProfileParameters convertSpecificProfileParameters(int profileType, RequestProfileParamsRestrictions restrictions, APIEnums.VehicleType vehicleType) { ProfileParameters params = new ProfileParameters(); if (RoutingProfileType.isHeavyVehicle(profileType)) params = convertHeavyVehicleParameters...
@Test public void convertSpecificProfileParameters() { RequestProfileParamsRestrictions restrictions = new RequestProfileParamsRestrictions(); restrictions.setHeight(10.0f); ProfileParameters params = handler.convertSpecificProfileParameters(2, restrictions, APIEnums.VehicleType.HGV); Assert.assertTrue(params instanceo...