79 if (locationListManager ==
null) {
80 System.err.println(
"LocationListManager not initialized");
86 locationListManager.addLocationListListener(locationListListener);
87 System.out.println(
"Added location list listener");
92 locationListManager.updateLocationList();
93 System.out.println(
"Requested location list update");
98 Map<Integer, LocationInfo> currentLocationList = locationListManager.getLocationList();
99 System.out.println(
"Current location list contains " + currentLocationList.size() +
" locations");
107 }
catch (InterruptedException e) {
108 Thread.currentThread().interrupt();
113 locationListManager.removeLocationListListener(locationListListener);
114 System.out.println(
"Removed location list listener");
173 System.out.println(
"=== Advanced Location List Features ===");
175 if (locationListManager ==
null) {
180 LocationListListener listener1 =
new LocationListListener() {
182 public void onLocationListLoaded(Map<Integer, LocationInfo> locationInfos) {
183 System.out.println(
"Listener 1: Location list loaded - " + locationInfos.size() +
" locations");
187 public void onLocationListFailed(java.lang.Error error) {
188 System.out.println(
"Listener 1: Location list failed - " + error.getMessage());
192 LocationListListener listener2 =
new LocationListListener() {
194 public void onLocationListLoaded(Map<Integer, LocationInfo> locationInfos) {
195 System.out.println(
"Listener 2: Location list loaded - " + locationInfos.size() +
" locations");
199 public void onLocationListFailed(java.lang.Error error) {
200 System.out.println(
"Listener 2: Location list failed - " + error.getMessage());
206 locationListManager.addLocationListListener(listener1);
207 System.out.println(
"Added first location list listener");
212 }
catch (InterruptedException e) {
213 Thread.currentThread().interrupt();
218 locationListManager.addLocationListListener(listener2);
219 System.out.println(
"Added second location list listener");
223 locationListManager.updateLocationList();
228 }
catch (InterruptedException e) {
229 Thread.currentThread().interrupt();
235 locationListManager.removeLocationListListener(listener1);
236 System.out.println(
"Removed first location list listener");
241 }
catch (InterruptedException e) {
242 Thread.currentThread().interrupt();
247 locationListManager.removeLocationListListener(listener2);
248 System.out.println(
"Removed second location list listener");
256 System.out.println(
"=== Location List Simulation ===");
259 Map<Integer, LocationInfo> simulatedLocations = Map.of(
260 1001,
new LocationInfo(1001, 1,
"Shopping Mall"),
261 1002,
new LocationInfo(1002, 2,
"Office Building"),
262 1003,
new LocationInfo(1003, 1,
"Airport Terminal"),
263 1004,
new LocationInfo(1004, 3,
"University Campus")
270 }
catch (InterruptedException e) {
271 Thread.currentThread().interrupt();
273 System.out.println(
"Simulated location list loaded");
281 }
catch (InterruptedException e) {
282 Thread.currentThread().interrupt();
284 Map<Integer, LocationInfo> updatedLocations = Map.of(
285 1001,
new LocationInfo(1001, 2,
"Shopping Mall - Updated"),
286 1002,
new LocationInfo(1002, 3,
"Office Building - Updated"),
287 1003,
new LocationInfo(1003, 2,
"Airport Terminal - Updated"),
288 1004,
new LocationInfo(1004, 4,
"University Campus - Updated"),
289 1005,
new LocationInfo(1005, 1,
"New Hospital")
291 System.out.println(
"Simulated location list updated");
300 System.out.println(
"=== Location List Listener Management ===");
302 if (locationListManager ==
null) {
307 LocationListListener testListener =
new LocationListListener() {
309 public void onLocationListLoaded(Map<Integer, LocationInfo> locationInfos) {
310 System.out.println(
"Test listener received location list: " + locationInfos.size() +
" locations");
314 public void onLocationListFailed(java.lang.Error error) {
315 System.out.println(
"Test listener received error: " + error.getMessage());
320 locationListManager.addLocationListListener(testListener);
321 System.out.println(
"Added test location list listener");
324 locationListManager.updateLocationList();
330 }
catch (InterruptedException e) {
331 Thread.currentThread().interrupt();
335 locationListManager.removeLocationListListener(testListener);
336 System.out.println(
"Removed test location list listener");