@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], 0.0f); Assert.assertEquals(20.0, info.getRanges()[1], 0.0f); info = new TravellerInfo(); rangeValues = new ArrayList<>(); rangeValues.add(15.0); rangeValues.add(30.0); handler.setRangeAndIntervals(info, rangeValues, intervalValue); Assert.assertEquals(15.0, info.getRanges()[0], 0.0f); Assert.assertEquals(30.0, info.getRanges()[1], 0.0f); }
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[]{rangeValue}); } catch (NumberFormatException ex) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, "range"); } } else { double[] ranges = new double[rangeValues.size()]; double maxRange = Double.MIN_VALUE; for (int i = 0; i < ranges.length; i++) { double dv = rangeValues.get(i); if (dv > maxRange) maxRange = dv; ranges[i] = dv; } Arrays.sort(ranges); travellerInfo.setRanges(ranges); } if (rangeValues.size() == 1 && rangeValue != -1 && intervalValue != null){ travellerInfo.setRanges(rangeValue, intervalValue); } }
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[]{rangeValue}); } catch (NumberFormatException ex) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, "range"); } } else { double[] ranges = new double[rangeValues.size()]; double maxRange = Double.MIN_VALUE; for (int i = 0; i < ranges.length; i++) { double dv = rangeValues.get(i); if (dv > maxRange) maxRange = dv; ranges[i] = dv; } Arrays.sort(ranges); travellerInfo.setRanges(ranges); } if (rangeValues.size() == 1 && rangeValue != -1 && intervalValue != null){ travellerInfo.setRanges(rangeValue, intervalValue); } } }
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[]{rangeValue}); } catch (NumberFormatException ex) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, "range"); } } else { double[] ranges = new double[rangeValues.size()]; double maxRange = Double.MIN_VALUE; for (int i = 0; i < ranges.length; i++) { double dv = rangeValues.get(i); if (dv > maxRange) maxRange = dv; ranges[i] = dv; } Arrays.sort(ranges); travellerInfo.setRanges(ranges); } if (rangeValues.size() == 1 && rangeValue != -1 && intervalValue != null){ travellerInfo.setRanges(rangeValue, intervalValue); } } IsochronesRequestHandler(); }
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[]{rangeValue}); } catch (NumberFormatException ex) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, "range"); } } else { double[] ranges = new double[rangeValues.size()]; double maxRange = Double.MIN_VALUE; for (int i = 0; i < ranges.length; i++) { double dv = rangeValues.get(i); if (dv > maxRange) maxRange = dv; ranges[i] = dv; } Arrays.sort(ranges); travellerInfo.setRanges(ranges); } if (rangeValues.size() == 1 && rangeValue != -1 && intervalValue != null){ travellerInfo.setRanges(rangeValue, intervalValue); } } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest(); }
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[]{rangeValue}); } catch (NumberFormatException ex) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, "range"); } } else { double[] ranges = new double[rangeValues.size()]; double maxRange = Double.MIN_VALUE; for (int i = 0; i < ranges.length; i++) { double dv = rangeValues.get(i); if (dv > maxRange) maxRange = dv; ranges[i] = dv; } Arrays.sort(ranges); travellerInfo.setRanges(ranges); } if (rangeValues.size() == 1 && rangeValue != -1 && intervalValue != null){ travellerInfo.setRanges(rangeValue, intervalValue); } } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest();  }