blob: 38d3a5c9370719aac57a489d808579890a448538 [file] [log] [blame]
Francesco Furfariec7e1752006-10-02 13:37:04 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
Francesco Furfari91af5da2006-04-04 23:44:23 +00009 *
Francesco Furfariec7e1752006-10-02 13:37:04 +000010 * http://www.apache.org/licenses/LICENSE-2.0
Francesco Furfari91af5da2006-04-04 23:44:23 +000011 *
Francesco Furfariec7e1752006-10-02 13:37:04 +000012 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
Francesco Furfari91af5da2006-04-04 23:44:23 +000018 */
19
20package org.apache.felix.upnp.tester.discovery;
21
22import java.util.*;
23
Francesco Furfarif2a67912006-07-17 17:08:02 +000024/*
Karl Paulsd312acc2007-06-18 20:38:33 +000025* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
Francesco Furfarif2a67912006-07-17 17:08:02 +000026*/
Francesco Furfari91af5da2006-04-04 23:44:23 +000027public class DevicesList {
28
29 ArrayList devices;
30 DeviceChangeListener listener = null;
31
32 public DevicesList(){
33 devices = new ArrayList();
34 }
35
36
37 public boolean add(DeviceNode dev) {
38 if(listener!=null)
39 listener.addedDevice(dev);
40 return devices.add(dev);
41 }
42
43 public Iterator iterator() {
44 return devices.iterator();
45 }
46
47 public boolean remove(DeviceNode dev) {
48 if(listener!=null)
49 listener.removedDevice(dev);
50 return devices.remove(dev);
51 }
52
53 public DeviceChangeListener getChangeListener() {
54 return listener;
55 }
56
57 public void setChangeListener(DeviceChangeListener listener) {
58 this.listener = listener;
59 }
60
61
62}