package com.walker.infrastructure; import com.walker.location.GeoHashHelper; import java.util.ArrayList; import java.util.List; public class MockUtils { public static final List
searchAround(List
data, List aroundList9, int geoSize){ List
resultList = new ArrayList<>(); for(Address address: data){ for(String geoHash: aroundList9){ if(geoHash.substring(0, geoSize).equals(address.getGeoHash().substring(0, geoSize))){ resultList.add(address); // 只要一个匹配就退出二级循环,直接比较下一个。 break; } } } return resultList; } public static final List
acquireTestAddressList(GeoHashHelper geoHashHelper){ List
data = new ArrayList<>(); // 113.629615,34.874807 data.add(new Address("菜鸟驿站", 113.629615, 34.874807, geoHashHelper)); // 113.628542,34.874955 data.add(new Address("青青果园", 113.628542, 34.874955, geoHashHelper)); // 113.628209,34.873782 data.add(new Address("日日鲜蛋糕", 113.628209, 34.873782, geoHashHelper)); // 113.628546,34.876051 data.add(new Address("福状元", 113.628546, 34.876051, geoHashHelper)); // 113.623835,34.878191 data.add(new Address("田园风光", 113.623835, 34.878191, geoHashHelper)); // 113.61707,34.875844 data.add(new Address("郑州三院(惠济院区)", 113.61707, 34.875844, geoHashHelper)); // 113.620969,34.861406 data.add(new Address("锦艺四季城", 113.620969, 34.861406, geoHashHelper)); // 113.644325,34.874015 data.add(new Address("惠济万达", 113.644325, 34.874015, geoHashHelper)); // 113.633123,34.84301 data.add(new Address("省体育中心", 113.633123, 34.84301, geoHashHelper)); // 113.641136,34.830744 data.add(new Address("普罗旺市", 113.641136, 34.830744, geoHashHelper)); // 113.673246,34.805999 data.add(new Address("赛博数码广场", 113.673246, 34.805999, geoHashHelper)); // 113.736087,34.778367 data.add(new Address("郑州会展中心", 113.736087, 34.778367, geoHashHelper)); // 113.814118,34.800346 data.add(new Address("智慧岛大厦", 113.814118, 34.800346, geoHashHelper)); // 113.543742,34.823359 data.add(new Address("郑州大学", 113.543742, 34.823359, geoHashHelper)); // 113.654108,34.673294 data.add(new Address("南环公园", 113.654108, 34.673294, geoHashHelper)); // 113.858939,34.53253 data.add(new Address("新郑机场", 113.858939, 34.53253, geoHashHelper)); // 113.781074,34.388741 data.add(new Address("新郑火车站", 113.781074, 34.388741, geoHashHelper)); // 113.855364,34.071009 data.add(new Address("许昌中央公园", 113.855364, 34.071009, geoHashHelper)); return data; } }