| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.commons.net.util.ListenerList |
|
|
| 1 | /* |
|
| 2 | * Copyright 2001-2005 The Apache Software Foundation |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at |
|
| 7 | * |
|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 | * |
|
| 10 | * Unless required by applicable law or agreed to in writing, software |
|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 | * See the License for the specific language governing permissions and |
|
| 14 | * limitations under the License. |
|
| 15 | */ |
|
| 16 | package org.apache.commons.net.util; |
|
| 17 | ||
| 18 | import java.io.Serializable; |
|
| 19 | import java.util.Enumeration; |
|
| 20 | import java.util.EventListener; |
|
| 21 | import java.util.Vector; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @author Daniel F. Savarese |
|
| 25 | */ |
|
| 26 | ||
| 27 | public class ListenerList implements Serializable |
|
| 28 | { |
|
| 29 | private Vector __listeners; |
|
| 30 | ||
| 31 | public ListenerList() |
|
| 32 | 0 | { |
| 33 | 0 | __listeners = new Vector(); |
| 34 | 0 | } |
| 35 | ||
| 36 | public synchronized void addListener(EventListener listener) |
|
| 37 | { |
|
| 38 | 0 | __listeners.addElement(listener); |
| 39 | 0 | } |
| 40 | ||
| 41 | public synchronized void removeListener(EventListener listener) |
|
| 42 | { |
|
| 43 | 0 | __listeners.removeElement(listener); |
| 44 | 0 | } |
| 45 | ||
| 46 | public synchronized Enumeration getListeners() |
|
| 47 | { |
|
| 48 | 0 | return ((Vector)__listeners.clone()).elements(); |
| 49 | } |
|
| 50 | ||
| 51 | public int getListenerCount() |
|
| 52 | { |
|
| 53 | 0 | return __listeners.size(); |
| 54 | } |
|
| 55 | ||
| 56 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |