File Source: DCCEvents.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.addons.dcc.actions;
    24  
    25  import com.dmdirc.Server;
    26  import com.dmdirc.actions.interfaces.ActionMetaType;
    27  
    28  import com.dmdirc.addons.dcc.DCCChatWindow;
    29  import com.dmdirc.addons.dcc.DCCSendWindow;
    30  
    31  import java.io.File;
    32  
    33  /**
    34   * Defines DCC-related events.
    35   *
    36   * @author Chris
    37   */
         /* 
    P/P   *  Method: DCCEvents valueOf(String)
          * 
          *  Postconditions:
          *    init'ed(return_value)
          */
    38  public enum DCCEvents implements ActionMetaType {
    39  	/** DCC Chat Request. */
        	 /* 
    P/P 	  *  Method: com.dmdirc.addons.dcc.actions.DCCEvents__static_init
        	  * 
        	  *  Presumptions:
        	  *    init'ed(java.lang.Integer.TYPE)
        	  * 
        	  *  Postconditions:
        	  *    $VALUES == &new DCCEvents[](DCCEvents__static_init#34)
        	  *    DCC_CHAT_MESSAGE == &new DCCEvents(DCCEvents__static_init#7)
        	  *    $VALUES[2] == &new DCCEvents(DCCEvents__static_init#7)
        	  *    DCC_CHAT_REQUEST == &new DCCEvents(DCCEvents__static_init#1)
        	  *    $VALUES[0] == &new DCCEvents(DCCEvents__static_init#1)
        	  *    DCC_CHAT_REQUEST_SENT == &new DCCEvents(DCCEvents__static_init#4)
        	  *    $VALUES[1] == &new DCCEvents(DCCEvents__static_init#4)
        	  *    DCC_CHAT_SELFMESSAGE == &new DCCEvents(DCCEvents__static_init#10)
        	  *    $VALUES[3] == &new DCCEvents(DCCEvents__static_init#10)
        	  *    DCC_CHAT_SOCKETCLOSED == &new DCCEvents(DCCEvents__static_init#13)
        	  *    ...
        	  */
    40  	DCC_CHAT_REQUEST(new String[]{"server", "client"}, Server.class, String.class),
    41  	/** DCC Chat Request Sent. */
    42  	DCC_CHAT_REQUEST_SENT(new String[]{"server", "client"}, Server.class, String.class),
    43  	/** DCC Message from another person. */
    44  	DCC_CHAT_MESSAGE(new String[]{"DCCChatWindow", "Nickname", "Message"}, DCCChatWindow.class, String.class, String.class),
    45  	/** DCC Message to another person. */
    46  	DCC_CHAT_SELFMESSAGE(new String[]{"DCCChatWindow", "Message"}, DCCChatWindow.class, String.class),
    47  	/** DCC Chat Socket Closed. */
    48  	DCC_CHAT_SOCKETCLOSED(new String[]{"DCCChatWindow"}, DCCChatWindow.class),
    49  	/** DCC Chat Socket Opened. */
    50  	DCC_CHAT_SOCKETOPENED(new String[]{"DCCChatWindow"}, DCCChatWindow.class),
    51  
    52  	/** DCC Send Socket Closed. */
    53  	DCC_SEND_SOCKETCLOSED(new String[]{"DCCSendWindow"}, DCCSendWindow.class),
    54  	/** DCC Send Socket Opened. */
    55  	DCC_SEND_SOCKETOPENED(new String[]{"DCCSendWindow"}, DCCSendWindow.class),
    56  	/** DCC Send Data Transfered */
    57  	DCC_SEND_DATATRANSFERED(new String[]{"DCCSendWindow", "Bytes Transfered"}, DCCSendWindow.class, int.class),
    58  	/** DCC Send Request. */
    59  	DCC_SEND_REQUEST(new String[]{"server", "client", "file"}, Server.class, String.class, String.class),
    60  	/** DCC Send Request Sent. */
    61  	DCC_SEND_REQUEST_SENT(new String[]{"server", "client", "file"}, Server.class, String.class, File.class);
    62  
    63  
    64  	/** The names of the arguments for this meta type. */
    65  	private String[] argNames;
    66  	/** The classes of the arguments for this meta type. */
    67  	private Class[] argTypes;
    68  	
    69  	/**
    70  	 * Creates a new instance of this meta-type.
    71  	 *
    72  	 * @param argNames The names of the meta-type's arguments
    73  	 * @param argTypes The types of the meta-type's arguments
    74  	 */
        	 /* 
    P/P 	  *  Method: void com.dmdirc.addons.dcc.actions.DCCEvents(String, int, String[], Class[])
        	  * 
        	  *  Postconditions:
        	  *    this.argNames == argNames
        	  *    init'ed(this.argNames)
        	  *    this.argTypes == argTypes
        	  *    init'ed(this.argTypes)
        	  */
    75  	DCCEvents(final String[] argNames, final Class ... argTypes) {
    76  		this.argNames = argNames;
    77  		this.argTypes = argTypes;
    78  	}
    79  	
    80  	/** {@inheritDoc} */
    81      @Override
    82  	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
        		  */
    83  		return argNames.length;
    84  	}
    85  	
    86  	/** {@inheritDoc} */
    87      @Override
    88  	public Class[] getArgTypes() {
        		 /* 
    P/P 		  *  Method: Class[] getArgTypes()
        		  * 
        		  *  Preconditions:
        		  *    init'ed(this.argTypes)
        		  * 
        		  *  Postconditions:
        		  *    return_value == this.argTypes
        		  *    init'ed(return_value)
        		  */
    89  		return argTypes;
    90  	}
    91  	
    92  	/** {@inheritDoc} */
    93      @Override
    94  	public String[] getArgNames() {
        		 /* 
    P/P 		  *  Method: String[] getArgNames()
        		  * 
        		  *  Preconditions:
        		  *    init'ed(this.argNames)
        		  * 
        		  *  Postconditions:
        		  *    return_value == this.argNames
        		  *    init'ed(return_value)
        		  */
    95  		return argNames;
    96  	}
    97  	
    98  	/** {@inheritDoc} */
    99      @Override
   100  	public String getGroup() {
        		 /* 
    P/P 		  *  Method: String getGroup()
        		  * 
        		  *  Postconditions:
        		  *    return_value == &amp;"DCC Events"
        		  */
   101  		return "DCC Events";
   102  	}
   103  	
   104  }








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