Class LocationUtil
- java.lang.Object
-
- org.linuxforhealth.fhir.search.location.util.LocationUtil
-
public class LocationUtil extends java.lang.ObjectCommon Location related functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.DoublecheckAndLimitMaximumLatitude(java.lang.Double value)force the latitude to a minimumstatic java.lang.DoublecheckAndLimitMaximumLongitude(java.lang.Double value)force the longitude to a minimumstatic booleancheckLatValid(java.lang.Double lat)common constraint for valid latitude and longitude.static booleancheckLonValid(java.lang.Double lon)common constraint for valid latitude and longitude.static booleancheckNull(java.lang.Double val)if null, return true.static voidcheckOverUnderNinety(java.lang.Double up, java.lang.Double down)check if the location/area spans over the pole (either one).static intfindNearParameterIndex(java.util.List<QueryParameter> searchParameters)Finds the index of the 'near' parameter in the passed list of search parameters.static booleanisLocation(java.lang.Class<?> resourceType, QueryParameter queryParm)Check if it's a location and 'near'
-
-
-
Method Detail
-
checkAndLimitMaximumLatitude
public static java.lang.Double checkAndLimitMaximumLatitude(java.lang.Double value)
force the latitude to a minimum- Parameters:
value-- Returns:
-
checkAndLimitMaximumLongitude
public static java.lang.Double checkAndLimitMaximumLongitude(java.lang.Double value)
force the longitude to a minimum- Parameters:
value-- Returns:
-
findNearParameterIndex
public static int findNearParameterIndex(java.util.List<QueryParameter> searchParameters)
Finds the index of the 'near' parameter in the passed list of search parameters. If not found, -1 is returned.- Parameters:
searchParameters-- Returns:
- int - The index of the 'near' parameter in the passed List.
-
isLocation
public static boolean isLocation(java.lang.Class<?> resourceType, QueryParameter queryParm)Check if it's a location and 'near'- Parameters:
resourceType-queryParm-- Returns:
-
checkNull
public static boolean checkNull(java.lang.Double val)
if null, return true.- Parameters:
val-- Returns:
-
checkLatValid
public static boolean checkLatValid(java.lang.Double lat)
common constraint for valid latitude and longitude.- Parameters:
lat-- Returns:
-
checkLonValid
public static boolean checkLonValid(java.lang.Double lon)
common constraint for valid latitude and longitude.- Parameters:
lon-- Returns:
-
checkOverUnderNinety
public static void checkOverUnderNinety(java.lang.Double up, java.lang.Double down) throws FHIRSearchExceptioncheck if the location/area spans over the pole (either one). If it does, just frankly, it's hard to do the math properly.- Parameters:
up-down-- Throws:
FHIRSearchException
-
-