File Source: ChannelEvents.java

     1  /*
     2   * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
     3   *
     4   * Permission is hereby granted, free of charge, to any person obtaining a copy
     5   * of this software and associated documentation files (the "Software"), to deal
     6   * in the Software without restriction, including without limitation the rights
     7   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     8   * copies of the Software, and to permit persons to whom the Software is
     9   * furnished to do so, subject to the following conditions:
    10   *
    11   * The above copyright notice and this permission notice shall be included in
    12   * all copies or substantial portions of the Software.
    13   *
    14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    20   * SOFTWARE.
    21   */
    22  
    23  package com.dmdirc.actions.metatypes;
    24  
    25  import com.dmdirc.Channel;
    26  import com.dmdirc.Topic;
    27  import com.dmdirc.actions.interfaces.ActionMetaType;
    28  import com.dmdirc.parser.irc.ChannelClientInfo;
    29  
    30  /**
    31   * Defines channel-related events.
    32   *
    33   * @author Chris
    34   */
         /* 
    P/P   *  Method: ChannelEvents valueOf(String)
          * 
          *  Postconditions:
          *    init'ed(return_value)
          */
    35  public enum ChannelEvents implements ActionMetaType {
    36  
    37      /** Channel event type. */
             /* 
    P/P       *  Method: com.dmdirc.actions.metatypes.ChannelEvents__static_init
              * 
              *  Postconditions:
              *    $VALUES == &new ChannelEvents[](ChannelEvents__static_init#22)
              *    CHANNEL_CTCP == &new ChannelEvents(ChannelEvents__static_init#10)
              *    $VALUES[3] == &new ChannelEvents(ChannelEvents__static_init#10)
              *    CHANNEL_EVENT == &new ChannelEvents(ChannelEvents__static_init#1)
              *    $VALUES[0] == &new ChannelEvents(ChannelEvents__static_init#1)
              *    CHANNEL_MODEEVENT == &new ChannelEvents(ChannelEvents__static_init#4)
              *    $VALUES[1] == &new ChannelEvents(ChannelEvents__static_init#4)
              *    CHANNEL_SOURCED_EVENT == &new ChannelEvents(ChannelEvents__static_init#13)
              *    $VALUES[4] == &new ChannelEvents(ChannelEvents__static_init#13)
              *    CHANNEL_SOURCED_EVENT_WITH_ARG == &new ChannelEvents(ChannelEvents__static_init#16)
              *    ...
              */
    38      CHANNEL_EVENT(new String[]{"channel"}, Channel.class),
    39      /** Channel mode event. */
    40      CHANNEL_MODEEVENT(new String[]{"channel", "modes"}, Channel.class, String.class),
    41      /** Channel topic event type. */
    42      CHANNEL_TOPICEVENT(new String[]{"channel", "topic"}, Channel.class, Topic.class),
    43      /** Channel CTCP type. */
    44      CHANNEL_CTCP(new String[]{"channel", "user", "type", "content"}, Channel.class, ChannelClientInfo.class, String.class, String.class),
    45      /** Channel event with source. */
    46      CHANNEL_SOURCED_EVENT(new String[]{"channel", "user"}, Channel.class, ChannelClientInfo.class),
    47      /** Chanel event with source and argument. */
    48      CHANNEL_SOURCED_EVENT_WITH_ARG(new String[]{"channel", "user", "message"}, Channel.class, ChannelClientInfo.class, String.class),
    49      /** Channel event with source and victim. */
    50      CHANNEL_SOURCED_EVENT_WITH_VICTIM(new String[]{"channel", "user", "victim", "message"}, Channel.class, ChannelClientInfo.class, ChannelClientInfo.class, String.class);
    51  
    52      /** The names of the arguments for this meta type. */
    53      private String[] argNames;
    54      /** The classes of the arguments for this meta type. */
    55      private Class[] argTypes;
    56  
    57      /**
    58       * Creates a new instance of this meta-type.
    59       *
    60       * @param argNames The names of the meta-type's arguments
    61       * @param argTypes The types of the meta-type's arguments
    62       */
             /* 
    P/P       *  Method: void com.dmdirc.actions.metatypes.ChannelEvents(String, int, String[], Class[])
              * 
              *  Postconditions:
              *    this.argNames == argNames
              *    init'ed(this.argNames)
              *    this.argTypes == argTypes
              *    init'ed(this.argTypes)
              */
    63      ChannelEvents(final String[] argNames, final Class ... argTypes) {
    64          this.argNames = argNames;
    65          this.argTypes = argTypes;
    66      }
    67  
    68      /** {@inheritDoc} */
    69      @Override
    70      public int getArity() {
                 /* 
    P/P           *  Method: int getArity()
                  * 
                  *  Preconditions:
                  *    this.argNames != null
                  *    this.argNames.length <= 232-1
                  * 
                  *  Postconditions:
                  *    return_value == this.argNames.length
                  *    return_value >= 0
                  */
    71          return argNames.length;
    72      }
    73  
    74      /** {@inheritDoc} */
    75      @Override
    76      public Class[] getArgTypes() {
                 /* 
    P/P           *  Method: Class[] getArgTypes()
                  * 
                  *  Preconditions:
                  *    init'ed(this.argTypes)
                  * 
                  *  Postconditions:
                  *    return_value == this.argTypes
                  *    init'ed(return_value)
                  */
    77          return argTypes;
    78      }
    79  
    80      /** {@inheritDoc} */
    81      @Override
    82      public String[] getArgNames() {
                 /* 
    P/P           *  Method: String[] getArgNames()
                  * 
                  *  Preconditions:
                  *    init'ed(this.argNames)
                  * 
                  *  Postconditions:
                  *    return_value == this.argNames
                  *    init'ed(return_value)
                  */
    83          return argNames;
    84      }
    85  
    86      /** {@inheritDoc} */
    87      @Override
    88      public String getGroup() {
                 /* 
    P/P           *  Method: String getGroup()
                  * 
                  *  Postconditions:
                  *    return_value == &amp;"Channel Events"
                  */
    89          return "Channel Events";
    90      }
    91  
    92  }








SofCheck Inspector Build Version : 2.17854
ChannelEvents.java 2009-Jun-25 01:54:24
ChannelEvents.class 2009-Sep-02 17:04:13