moved Pair and Triple from com.sap.sailing.common.Util to com.sap.sse.common.Util and introduced all missing dependencies on com.sap.sse.common

This commit is contained in:
Axel Uhl
2014-06-02 23:31:26 +02:00
parent c4cea6660d
commit 0c47e86304
334 changed files with 1540 additions and 1692 deletions
@@ -8,4 +8,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.sap.sailing.geocoding
Require-Bundle: org.json.simple;bundle-version="1.1.0",
com.sap.sailing.domain.common
com.sap.sailing.domain.common,
com.sap.sse.common
@@ -24,9 +24,9 @@ import com.sap.sailing.domain.common.Position;
import com.sap.sailing.domain.common.SerializablePosition;
import com.sap.sailing.domain.common.impl.PlacemarkImpl;
import com.sap.sailing.domain.common.impl.SerializablePositionImpl;
import com.sap.sailing.domain.common.impl.Util.Triple;
import com.sap.sailing.domain.common.quadtree.QuadTree;
import com.sap.sailing.geocoding.ReverseGeocoder;
import com.sap.sse.common.Util;
public class ReverseGeocoderImpl implements ReverseGeocoder {
@@ -43,12 +43,12 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
private final int MAX_ROW_NUMBER = 1000;
private final int MAX_RADIUS = 300;
private QuadTree<Triple<Position, Double, List<Placemark>>> cache = new QuadTree<Triple<Position,Double,List<Placemark>>>();;
private QuadTree<Util.Triple<Position, Double, List<Placemark>>> cache = new QuadTree<Util.Triple<Position,Double,List<Placemark>>>();;
@Override
public Placemark getPlacemarkNearest(Position position) throws IOException, ParseException {
Placemark p = null;
Triple<Position, Double, List<Placemark>> cachedPlacemarks = checkCache(position);
Util.Triple<Position, Double, List<Placemark>> cachedPlacemarks = checkCache(position);
if (cachedPlacemarks != null && cachedPlacemarks.getC() != null && !cachedPlacemarks.getC().isEmpty()) {
p = cachedPlacemarks.getC().get(0);
@@ -71,7 +71,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
@Override
public List<Placemark> getPlacemarksNear(Position position, double radius) throws IOException, ParseException {
List<Placemark> placemarks = null;
Triple<Position, Double, List<Placemark>> cachedPlacemarks = checkCache(position);
Util.Triple<Position, Double, List<Placemark>> cachedPlacemarks = checkCache(position);
//Calculating the search radius and the maximum number of returning Placemarks
double limitedRadius = Math.min(radius, MAX_RADIUS);
@@ -198,7 +198,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
Collections.sort(placemarks, new Placemark.ByDistance(position));
if (position != null) {
synchronized (cache) {
cache.put(position, new Triple<Position, Double, List<Placemark>>(position, radius, placemarks));
cache.put(position, new Util.Triple<Position, Double, List<Placemark>>(position, radius, placemarks));
}
}
}
@@ -217,7 +217,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
private void updateCachedPlacemarks(Position cachedPoint, Double newRadius, List<Placemark> newPlacemarks) {
if (cachedPoint != null) {
synchronized (cache) {
cache.replace(cachedPoint, new Triple<Position, Double, List<Placemark>>(cachedPoint, newRadius, newPlacemarks));
cache.replace(cachedPoint, new Util.Triple<Position, Double, List<Placemark>>(cachedPoint, newRadius, newPlacemarks));
}
}
}
@@ -229,7 +229,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
* <code>null</code>, if there's nothing cached around <code>position</code> within
* {@link ReverseGeocoderImpl#POSITION_CACHE_DISTANCE_LIMIT the distance limit}
*/
private Triple<Position, Double, List<Placemark>> checkCache(Position position) {
private Util.Triple<Position, Double, List<Placemark>> checkCache(Position position) {
synchronized (cache) {
return cache.get(position, POSITION_CACHE_DISTANCE_LIMIT);
}