View Javadoc

1   /* Copyright 2006 The JA-SIG Collaborative.  All rights reserved.
2   *  See license distributed with this file and
3   *  available online at http://www.uportal.org/license.html
4   */
5   
6   package org.jasig.irclog.events;
7   
8   import java.util.ArrayList;
9   import java.util.Arrays;
10  import java.util.Collections;
11  import java.util.Date;
12  import java.util.List;
13  
14  import org.jibble.pircbot.PircBot;
15  
16  /***
17   * @see PircBot#onTopic(String, String, String, long, boolean)
18   * 
19   * @author Eric Dalquist <a href="mailto:eric.dalquist@doit.wisc.edu">eric.dalquist@doit.wisc.edu</a>
20   * @version $Revision$
21   */
22  public class TopicEvent extends ChannelEvent {
23      private static final List<String> PROPERTIES = Collections.unmodifiableList(Arrays.asList(new String[] { "topic", "setBy", "topicDate", "changed" }));
24      
25      protected final String topic;
26      protected final String setBy;
27      protected final Date topicDate;
28      protected final boolean changed;
29      
30      public TopicEvent(final PircBot source, final String channel, final String topic, final String setBy, final long topicDate, final boolean changed) {
31          super(source, channel);
32          this.topic = topic;
33          this.setBy = setBy;
34          this.topicDate = new Date(topicDate);
35          this.changed = changed;
36      }
37  
38      /***
39       * @see org.jasig.irclog.events.IrcEvent#getArgumentProperties()
40       */
41      @Override
42      protected List<String> getArgumentProperties() {
43          final List<String> parentProps = super.getArgumentProperties();
44          final List<String> props = new ArrayList<String>(PROPERTIES.size() + parentProps.size());
45          
46          props.addAll(parentProps);
47          props.addAll(PROPERTIES);
48          
49          return props;
50      }
51  
52      /***
53       * @return the changed
54       */
55      public boolean isChanged() {
56          return this.changed;
57      }
58  
59      /***
60       * @return the setBy
61       */
62      public String getSetBy() {
63          return this.setBy;
64      }
65      
66      /***
67       * @return the topicDate
68       */
69      public Date getTopicDate() {
70          return this.topicDate;
71      }
72  
73      /***
74       * @return the topic
75       */
76      public String getTopic() {
77          return this.topic;
78      }
79  }