private FederatedService getProviderFromProviders( Set<FederatedService> providers) throws OutOfServiceAreaServiceException, MultipleServiceAreasServiceException { if (providers.size() == 1) return providers.iterator().next(); if (providers.size() == 0) throw new OutOfServiceAreaServiceException(); throw new MultipleServiceAreasServiceException(); }
private FederatedService getProviderFromProviders( Set<FederatedService> providers) throws OutOfServiceAreaServiceException, MultipleServiceAreasServiceException { if (providers.size() == 1) return providers.iterator().next(); if (providers.size() == 0) throw new OutOfServiceAreaServiceException(); throw new MultipleServiceAreasServiceException(); }
protected void checkBounds(CoordinateBounds cb) { if (cb == null) { return; } Collection<CoordinateBounds> allAgencyBounds = _agencyService.getAgencyIdsAndCoverageAreas().values(); for (CoordinateBounds agencyBounds : allAgencyBounds) { if (agencyBounds.intersects(cb)) { return; } } throw new OutOfServiceAreaServiceException(); }
@Override public FederatedService getServiceForLocations(List<CoordinatePoint> points) throws ServiceAreaServiceException { FederatedService service = null; for (CoordinatePoint point : points) { FederatedService provider = getServiceForLocation(point.getLat(), point.getLon()); if (service == null) { service = provider; } else if (service != provider) { throw new MultipleServiceAreasServiceException(); } } if (service == null) throw new OutOfServiceAreaServiceException(); return service; }