//# 0 errors, 136 messages
//#
/*
    //#eventlistenerlist.java:1:1: class: net.sourceforge.pebble.event.EventListenerList
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.sourceforge.pebble.event;

import net.sourceforge.pebble.api.event.blog.BlogListener;
import net.sourceforge.pebble.api.event.blogentry.BlogEntryListener;
import net.sourceforge.pebble.api.event.comment.CommentListener;
import net.sourceforge.pebble.api.event.trackback.TrackBackListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * Maintains a list of listeners, allowing them to be added and removed.
 *
 * @author Simon Brown
 */
public class EventListenerList {

  /** the log in use by this class */
  private static final Log log = LogFactory.getLog(EventListenerList.class);
    //#eventlistenerlist.java:52: method: net.sourceforge.pebble.event.EventListenerList.net.sourceforge.pebble.event.EventListenerList__static_init
    //#eventlistenerlist.java:52: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.EventListenerList
    //#    method: net.sourceforge.pebble.event.EventListenerList__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Descendant_Table[net/sourceforge/pebble/event/EventListenerList]
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addBlogEntryListener(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryListener;)V
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addBlogListener(Lnet/sourceforge/pebble/api/event/blog/BlogListener;)V
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addCommentListener(Lnet/sourceforge/pebble/api/event/comment/CommentListener;)V
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addTrackBackListener(Lnet/sourceforge/pebble/api/event/trackback/TrackBackListener;)V
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getBlogEntryListeners()Ljava/util/List;
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getBlogListeners()Ljava/util/List;
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getCommentListeners()Ljava/util/List;
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getTrackBackListeners()Ljava/util/List;
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.removeBlogListener(Lnet/sourceforge/pebble/api/event/blog/BlogListener;)V
    //#output(net.sourceforge.pebble.event.EventListenerList__static_init): log
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Descendant_Table[net/sourceforge/pebble/event/EventListenerList] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addBlogEntryListener(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryListener;)V == &addBlogEntryListener
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addBlogListener(Lnet/sourceforge/pebble/api/event/blog/BlogListener;)V == &addBlogListener
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addCommentListener(Lnet/sourceforge/pebble/api/event/comment/CommentListener;)V == &addCommentListener
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.addTrackBackListener(Lnet/sourceforge/pebble/api/event/trackback/TrackBackListener;)V == &addTrackBackListener
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getBlogEntryListeners()Ljava/util/List; == &getBlogEntryListeners
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getBlogListeners()Ljava/util/List; == &getBlogListeners
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getCommentListeners()Ljava/util/List; == &getCommentListeners
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.getTrackBackListeners()Ljava/util/List; == &getTrackBackListeners
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): __Dispatch_Table.removeBlogListener(Lnet/sourceforge/pebble/api/event/blog/BlogListener;)V == &removeBlogListener
    //#post(net.sourceforge.pebble.event.EventListenerList__static_init): init'ed(log)
    //#eventlistenerlist.java:52: end of method: net.sourceforge.pebble.event.EventListenerList.net.sourceforge.pebble.event.EventListenerList__static_init

  /** the list of blog listeners */
  private List blogListeners;

  /** the list of blog entry listeners */
  private List blogEntryListeners;

  /** the list of comment listeners */
  private List commentListeners;

  /** the list of TrackBack listeners */
  private List trackBackListeners;

  /**
   * Default, no args constructor.
   */
  public EventListenerList() {
    //#eventlistenerlist.java:69: method: void net.sourceforge.pebble.event.EventListenerList.net.sourceforge.pebble.event.EventListenerList()
    //#input(void net.sourceforge.pebble.event.EventListenerList()): this
    //#output(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#1) num objects
    //#output(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#2) num objects
    //#output(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#3) num objects
    //#output(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#4) num objects
    //#output(void net.sourceforge.pebble.event.EventListenerList()): this.blogEntryListeners
    //#output(void net.sourceforge.pebble.event.EventListenerList()): this.blogListeners
    //#output(void net.sourceforge.pebble.event.EventListenerList()): this.commentListeners
    //#output(void net.sourceforge.pebble.event.EventListenerList()): this.trackBackListeners
    //#new obj(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#1)
    //#new obj(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#2)
    //#new obj(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#3)
    //#new obj(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#4)
    //#post(void net.sourceforge.pebble.event.EventListenerList()): this.blogEntryListeners == &new ArrayList(EventListenerList#2)
    //#post(void net.sourceforge.pebble.event.EventListenerList()): this.blogListeners == &new ArrayList(EventListenerList#1)
    //#post(void net.sourceforge.pebble.event.EventListenerList()): this.commentListeners == &new ArrayList(EventListenerList#3)
    //#post(void net.sourceforge.pebble.event.EventListenerList()): this.trackBackListeners == &new ArrayList(EventListenerList#4)
    //#post(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#1) num objects == 1
    //#post(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#2) num objects == 1
    //#post(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#3) num objects == 1
    //#post(void net.sourceforge.pebble.event.EventListenerList()): new ArrayList(EventListenerList#4) num objects == 1
    this.blogListeners = new ArrayList();
    this.blogEntryListeners = new ArrayList();
    this.commentListeners = new ArrayList();
    this.trackBackListeners = new ArrayList();
  }
    //#eventlistenerlist.java:74: end of method: void net.sourceforge.pebble.event.EventListenerList.net.sourceforge.pebble.event.EventListenerList()

  /**
   * Gets the list of blog listeners.
   *
   * @return  a List of BlogListener instances
   */
  public List getBlogListeners() {
    return this.blogListeners;
    //#eventlistenerlist.java:82: method: List net.sourceforge.pebble.event.EventListenerList.getBlogListeners()
    //#input(List getBlogListeners()): this
    //#input(List getBlogListeners()): this.blogListeners
    //#output(List getBlogListeners()): return_value
    //#pre[2] (List getBlogListeners()): init'ed(this.blogListeners)
    //#post(List getBlogListeners()): return_value == this.blogListeners
    //#post(List getBlogListeners()): init'ed(return_value)
    //#eventlistenerlist.java:82: end of method: List net.sourceforge.pebble.event.EventListenerList.getBlogListeners()
  }

  /**
   * Registers a blog listener.
   *
   * @param listener    a BlogListener instance
   */
  public void addBlogListener(BlogListener listener) {
    if (!blogListeners.contains(listener)) {
    //#eventlistenerlist.java:91: method: void net.sourceforge.pebble.event.EventListenerList.addBlogListener(BlogListener)
    //#input(void addBlogListener(BlogListener)): listener
    //#input(void addBlogListener(BlogListener)): log
    //#input(void addBlogListener(BlogListener)): this
    //#input(void addBlogListener(BlogListener)): this.blogListeners
    //#pre[3] (void addBlogListener(BlogListener)): this.blogListeners != null
    //#pre[1] (void addBlogListener(BlogListener)): (soft) listener != null
    //#presumption(void addBlogListener(BlogListener)): java.lang.Object:getClass(...)@93 != null
    //#presumption(void addBlogListener(BlogListener)): org.apache.commons.logging.LogFactory:getLog(...)@52 != null
    //#test_vector(void addBlogListener(BlogListener)): java.util.List:contains(...)@91: {1}, {0}
      blogListeners.add(listener);
      log.debug(listener.getClass().getName() + " registered");
    //#eventlistenerlist.java:93: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.EventListenerList
    //#    method: void addBlogListener(BlogListener)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
  }
    //#eventlistenerlist.java:95: end of method: void net.sourceforge.pebble.event.EventListenerList.addBlogListener(BlogListener)

  /**
   * Unregisters a blog listener.
   *
   * @param listener    a BlogListener instance
   */
  public void removeBlogListener(BlogListener listener) {
    blogListeners.remove(listener);
    //#eventlistenerlist.java:103: method: void net.sourceforge.pebble.event.EventListenerList.removeBlogListener(BlogListener)
    //#input(void removeBlogListener(BlogListener)): listener
    //#input(void removeBlogListener(BlogListener)): this
    //#input(void removeBlogListener(BlogListener)): this.blogListeners
    //#pre[3] (void removeBlogListener(BlogListener)): this.blogListeners != null
  }
    //#eventlistenerlist.java:104: end of method: void net.sourceforge.pebble.event.EventListenerList.removeBlogListener(BlogListener)

  /**
   * Gets the list of blog entry listeners.
   *
   * @return  a List of BlogEntryListener instances
   */
  public List getBlogEntryListeners() {
    return this.blogEntryListeners;
    //#eventlistenerlist.java:112: method: List net.sourceforge.pebble.event.EventListenerList.getBlogEntryListeners()
    //#input(List getBlogEntryListeners()): this
    //#input(List getBlogEntryListeners()): this.blogEntryListeners
    //#output(List getBlogEntryListeners()): return_value
    //#pre[2] (List getBlogEntryListeners()): init'ed(this.blogEntryListeners)
    //#post(List getBlogEntryListeners()): return_value == this.blogEntryListeners
    //#post(List getBlogEntryListeners()): init'ed(return_value)
    //#eventlistenerlist.java:112: end of method: List net.sourceforge.pebble.event.EventListenerList.getBlogEntryListeners()
  }

  /**
   * Registers a blog entry listener.
   *
   * @param listener    a BlogEntryListener instance
   */
  public void addBlogEntryListener(BlogEntryListener listener) {
    if (!blogEntryListeners.contains(listener)) {
    //#eventlistenerlist.java:121: method: void net.sourceforge.pebble.event.EventListenerList.addBlogEntryListener(BlogEntryListener)
    //#input(void addBlogEntryListener(BlogEntryListener)): listener
    //#input(void addBlogEntryListener(BlogEntryListener)): log
    //#input(void addBlogEntryListener(BlogEntryListener)): this
    //#input(void addBlogEntryListener(BlogEntryListener)): this.blogEntryListeners
    //#pre[3] (void addBlogEntryListener(BlogEntryListener)): this.blogEntryListeners != null
    //#pre[1] (void addBlogEntryListener(BlogEntryListener)): (soft) listener != null
    //#presumption(void addBlogEntryListener(BlogEntryListener)): java.lang.Object:getClass(...)@123 != null
    //#presumption(void addBlogEntryListener(BlogEntryListener)): org.apache.commons.logging.LogFactory:getLog(...)@52 != null
    //#test_vector(void addBlogEntryListener(BlogEntryListener)): java.util.List:contains(...)@121: {1}, {0}
      blogEntryListeners.add(listener);
      log.debug(listener.getClass().getName() + " registered");
    //#eventlistenerlist.java:123: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.EventListenerList
    //#    method: void addBlogEntryListener(BlogEntryListener)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
  }
    //#eventlistenerlist.java:125: end of method: void net.sourceforge.pebble.event.EventListenerList.addBlogEntryListener(BlogEntryListener)

  /**
   * Gets the list of comment listeners.
   *
   * @return  a List of CommentListener instances
   */
  public List getCommentListeners() {
    return this.commentListeners;
    //#eventlistenerlist.java:133: method: List net.sourceforge.pebble.event.EventListenerList.getCommentListeners()
    //#input(List getCommentListeners()): this
    //#input(List getCommentListeners()): this.commentListeners
    //#output(List getCommentListeners()): return_value
    //#pre[2] (List getCommentListeners()): init'ed(this.commentListeners)
    //#post(List getCommentListeners()): return_value == this.commentListeners
    //#post(List getCommentListeners()): init'ed(return_value)
    //#eventlistenerlist.java:133: end of method: List net.sourceforge.pebble.event.EventListenerList.getCommentListeners()
  }

  /**
   * Registers a comment listener.
   *
   * @param listener    a CommentListener instance
   */
  public void addCommentListener(CommentListener listener) {
    if (!commentListeners.contains(listener)) {
    //#eventlistenerlist.java:142: method: void net.sourceforge.pebble.event.EventListenerList.addCommentListener(CommentListener)
    //#input(void addCommentListener(CommentListener)): listener
    //#input(void addCommentListener(CommentListener)): log
    //#input(void addCommentListener(CommentListener)): this
    //#input(void addCommentListener(CommentListener)): this.commentListeners
    //#pre[3] (void addCommentListener(CommentListener)): this.commentListeners != null
    //#pre[1] (void addCommentListener(CommentListener)): (soft) listener != null
    //#presumption(void addCommentListener(CommentListener)): java.lang.Object:getClass(...)@144 != null
    //#presumption(void addCommentListener(CommentListener)): org.apache.commons.logging.LogFactory:getLog(...)@52 != null
    //#test_vector(void addCommentListener(CommentListener)): java.util.List:contains(...)@142: {1}, {0}
      commentListeners.add(listener);
      log.debug(listener.getClass().getName() + " registered");
    //#eventlistenerlist.java:144: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.EventListenerList
    //#    method: void addCommentListener(CommentListener)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
  }
    //#eventlistenerlist.java:146: end of method: void net.sourceforge.pebble.event.EventListenerList.addCommentListener(CommentListener)

  /**
   * Gets the list of TrackBack listeners.
   *
   * @return  a List of TrackBackListener instances
   */
  public List getTrackBackListeners() {
    return this.trackBackListeners;
    //#eventlistenerlist.java:154: method: List net.sourceforge.pebble.event.EventListenerList.getTrackBackListeners()
    //#input(List getTrackBackListeners()): this
    //#input(List getTrackBackListeners()): this.trackBackListeners
    //#output(List getTrackBackListeners()): return_value
    //#pre[2] (List getTrackBackListeners()): init'ed(this.trackBackListeners)
    //#post(List getTrackBackListeners()): return_value == this.trackBackListeners
    //#post(List getTrackBackListeners()): init'ed(return_value)
    //#eventlistenerlist.java:154: end of method: List net.sourceforge.pebble.event.EventListenerList.getTrackBackListeners()
  }

  /**
   * Registers a TrackBack listener.
   *
   * @param listener    a TrackBackListener instance
   */
  public void addTrackBackListener(TrackBackListener listener) {
    if (!trackBackListeners.contains(listener)) {
    //#eventlistenerlist.java:163: method: void net.sourceforge.pebble.event.EventListenerList.addTrackBackListener(TrackBackListener)
    //#input(void addTrackBackListener(TrackBackListener)): listener
    //#input(void addTrackBackListener(TrackBackListener)): log
    //#input(void addTrackBackListener(TrackBackListener)): this
    //#input(void addTrackBackListener(TrackBackListener)): this.trackBackListeners
    //#pre[3] (void addTrackBackListener(TrackBackListener)): this.trackBackListeners != null
    //#pre[1] (void addTrackBackListener(TrackBackListener)): (soft) listener != null
    //#presumption(void addTrackBackListener(TrackBackListener)): java.lang.Object:getClass(...)@165 != null
    //#presumption(void addTrackBackListener(TrackBackListener)): org.apache.commons.logging.LogFactory:getLog(...)@52 != null
    //#test_vector(void addTrackBackListener(TrackBackListener)): java.util.List:contains(...)@163: {1}, {0}
      trackBackListeners.add(listener);
      log.debug(listener.getClass().getName() + " registered");
    //#eventlistenerlist.java:165: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.EventListenerList
    //#    method: void addTrackBackListener(TrackBackListener)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
  }
    //#eventlistenerlist.java:167: end of method: void net.sourceforge.pebble.event.EventListenerList.addTrackBackListener(TrackBackListener)


}
    //#eventlistenerlist.java:: end of class: net.sourceforge.pebble.event.EventListenerList
