2 Copyright (C) 2001, 2006 United States Government as represented by
3 the Administrator of the National Aeronautics and Space Administration.
6 package gov
.nasa
.worldwind
.layers
.placename
;
8 import gov
.nasa
.worldwind
.util
.Logging
;
13 * @author Paul Collins
14 * @version $Id: PlaceNameServiceSet.java 2471 2007-07-31 21:50:57Z tgaskins $
16 public class PlaceNameServiceSet
18 private final List
<PlaceNameService
> serviceList
= new LinkedList
<PlaceNameService
>();
20 public PlaceNameServiceSet()
25 * @param placeNameService
28 * @throws IllegalArgumentException if <code>placeNameService</code> is null
30 public boolean addService(PlaceNameService placeNameService
, boolean replace
)
32 if (placeNameService
== null)
34 String message
= Logging
.getMessage("nullValue.PlaceNameServiceIsNull");
35 Logging
.logger().severe(message
);
36 throw new IllegalArgumentException(message
);
39 for (int i
= 0; i
< this.serviceList
.size(); i
++)
41 final PlaceNameService other
= this.serviceList
.get(i
);
42 if (placeNameService
.getService().equals(other
.getService()) && placeNameService
.getDataset().equals(
47 this.serviceList
.set(i
, placeNameService
);
57 this.serviceList
.add(placeNameService
);
61 public final PlaceNameServiceSet
deepCopy()
63 PlaceNameServiceSet copy
= new PlaceNameServiceSet();
65 // Creates a deep copy of this.serviceList in copy.serviceList.
66 for (int i
= 0; i
< this.serviceList
.size(); i
++)
68 copy
.serviceList
.add(i
, this.serviceList
.get(i
).deepCopy());
74 public final int getServiceCount()
76 return this.serviceList
.size();
79 public final PlaceNameService
getService(int index
)
81 return this.serviceList
.get(index
);