Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../img/srcFileCovDistChart9.png 23% of files have more coverage
21   170   14   2,1
8   61   0,67   10
10     1,4  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  EventListenerList       Line # 49 21 0% 14 4 89,7% 0.8974359
 
  (192)
 
1    /*
2    * Copyright (c) 2003-2006, Simon Brown
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * - Redistributions of source code must retain the above copyright
9    * notice, this list of conditions and the following disclaimer.
10    *
11    * - Redistributions in binary form must reproduce the above copyright
12    * notice, this list of conditions and the following disclaimer in
13    * the documentation and/or other materials provided with the
14    * distribution.
15    *
16    * - Neither the name of Pebble nor the names of its contributors may
17    * be used to endorse or promote products derived from this software
18    * without specific prior written permission.
19    *
20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    * POSSIBILITY OF SUCH DAMAGE.
31    */
32    package net.sourceforge.pebble.event;
33   
34    import net.sourceforge.pebble.api.event.blog.BlogListener;
35    import net.sourceforge.pebble.api.event.blogentry.BlogEntryListener;
36    import net.sourceforge.pebble.api.event.comment.CommentListener;
37    import net.sourceforge.pebble.api.event.trackback.TrackBackListener;
38    import org.apache.commons.logging.Log;
39    import org.apache.commons.logging.LogFactory;
40   
41    import java.util.ArrayList;
42    import java.util.List;
43   
44    /**
45    * Maintains a list of listeners, allowing them to be added and removed.
46    *
47    * @author Simon Brown
48    */
 
49    public class EventListenerList {
50   
51    /** the log in use by this class */
52    private static final Log log = LogFactory.getLog(EventListenerList.class);
53   
54    /** the list of blog listeners */
55    private List blogListeners;
56   
57    /** the list of blog entry listeners */
58    private List blogEntryListeners;
59   
60    /** the list of comment listeners */
61    private List commentListeners;
62   
63    /** the list of TrackBack listeners */
64    private List trackBackListeners;
65   
66    /**
67    * Default, no args constructor.
68    */
 
69  1334 toggle public EventListenerList() {
70  1334 this.blogListeners = new ArrayList();
71  1334 this.blogEntryListeners = new ArrayList();
72  1334 this.commentListeners = new ArrayList();
73  1334 this.trackBackListeners = new ArrayList();
74    }
75   
76    /**
77    * Gets the list of blog listeners.
78    *
79    * @return a List of BlogListener instances
80    */
 
81  2642 toggle public List getBlogListeners() {
82  2642 return this.blogListeners;
83    }
84   
85    /**
86    * Registers a blog listener.
87    *
88    * @param listener a BlogListener instance
89    */
 
90  4 toggle public void addBlogListener(BlogListener listener) {
91  4 if (!blogListeners.contains(listener)) {
92  4 blogListeners.add(listener);
93  4 log.debug(listener.getClass().getName() + " registered");
94    }
95    }
96   
97    /**
98    * Unregisters a blog listener.
99    *
100    * @param listener a BlogListener instance
101    */
 
102  2 toggle public void removeBlogListener(BlogListener listener) {
103  2 blogListeners.remove(listener);
104    }
105   
106    /**
107    * Gets the list of blog entry listeners.
108    *
109    * @return a List of BlogEntryListener instances
110    */
 
111  324 toggle public List getBlogEntryListeners() {
112  324 return this.blogEntryListeners;
113    }
114   
115    /**
116    * Registers a blog entry listener.
117    *
118    * @param listener a BlogEntryListener instance
119    */
 
120  10678 toggle public void addBlogEntryListener(BlogEntryListener listener) {
121  10678 if (!blogEntryListeners.contains(listener)) {
122  10678 blogEntryListeners.add(listener);
123  10678 log.debug(listener.getClass().getName() + " registered");
124    }
125    }
126   
127    /**
128    * Gets the list of comment listeners.
129    *
130    * @return a List of CommentListener instances
131    */
 
132  142 toggle public List getCommentListeners() {
133  142 return this.commentListeners;
134    }
135   
136    /**
137    * Registers a comment listener.
138    *
139    * @param listener a CommentListener instance
140    */
 
141  9352 toggle public void addCommentListener(CommentListener listener) {
142  9352 if (!commentListeners.contains(listener)) {
143  9352 commentListeners.add(listener);
144  9352 log.debug(listener.getClass().getName() + " registered");
145    }
146    }
147   
148    /**
149    * Gets the list of TrackBack listeners.
150    *
151    * @return a List of TrackBackListener instances
152    */
 
153  26 toggle public List getTrackBackListeners() {
154  26 return this.trackBackListeners;
155    }
156   
157    /**
158    * Registers a TrackBack listener.
159    *
160    * @param listener a TrackBackListener instance
161    */
 
162  9352 toggle public void addTrackBackListener(TrackBackListener listener) {
163  9352 if (!trackBackListeners.contains(listener)) {
164  9352 trackBackListeners.add(listener);
165  9352 log.debug(listener.getClass().getName() + " registered");
166    }
167    }
168   
169   
170    }