File Source: QueryEvents.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.Query;
    26  import com.dmdirc.actions.interfaces.ActionMetaType;
    27  
    28  /**
    29   * Defines query-related events.
    30   *
    31   * @author Chris
    32   */
         /* 
    P/P   *  Method: QueryEvents valueOf(String)
          * 
          *  Postconditions:
          *    init'ed(return_value)
          */
    33  public enum QueryEvents implements ActionMetaType {
    34      
    35      /** Query event type. */
             /* 
    P/P       *  Method: com.dmdirc.actions.metatypes.QueryEvents__static_init
              * 
              *  Postconditions:
              *    $VALUES == &new QueryEvents[](QueryEvents__static_init#7)
              *    QUERY_EVENT == &new QueryEvents(QueryEvents__static_init#1)
              *    $VALUES[0] == &new QueryEvents(QueryEvents__static_init#1)
              *    QUERY_EVENT_WITH_ARG == &new QueryEvents(QueryEvents__static_init#4)
              *    $VALUES[1] == &new QueryEvents(QueryEvents__static_init#4)
              *    new Class[](QueryEvents__static_init#3) num objects == 1
              *    QUERY_EVENT.argTypes.length == 1
              *    new Class[](QueryEvents__static_init#6) num objects == 1
              *    new QueryEvents(QueryEvents__static_init#1) num objects == 1
              *    new QueryEvents(QueryEvents__static_init#4) num objects == 1
              *    ...
              */
    36      QUERY_EVENT(new String[]{"query"}, Query.class),
    37      /** Query event with argument. */
    38      QUERY_EVENT_WITH_ARG(new String[]{"query", "message"}, Query.class, String.class);
    39      
    40      /** The names of the arguments for this meta type. */
    41      private String[] argNames;
    42      /** The classes of the arguments for this meta type. */
    43      private Class[] argTypes;
    44      
    45      /**
    46       * Creates a new instance of this meta-type.
    47       *
    48       * @param argNames The names of the meta-type's arguments
    49       * @param argTypes The types of the meta-type's arguments
    50       */
             /* 
    P/P       *  Method: void com.dmdirc.actions.metatypes.QueryEvents(String, int, String[], Class[])
              * 
              *  Postconditions:
              *    this.argNames == argNames
              *    init'ed(this.argNames)
              *    this.argTypes == argTypes
              *    init'ed(this.argTypes)
              */
    51      QueryEvents(final String[] argNames, final Class ... argTypes) {
    52          this.argNames = argNames;
    53          this.argTypes = argTypes;
    54      }
    55      
    56      /** {@inheritDoc} */
    57      @Override
    58      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
                  */
    59          return argNames.length;
    60      }
    61      
    62      /** {@inheritDoc} */
    63      @Override
    64      public Class[] getArgTypes() {
                 /* 
    P/P           *  Method: Class[] getArgTypes()
                  * 
                  *  Preconditions:
                  *    init'ed(this.argTypes)
                  * 
                  *  Postconditions:
                  *    return_value == this.argTypes
                  *    init'ed(return_value)
                  */
    65          return argTypes;
    66      }
    67      
    68      /** {@inheritDoc} */
    69      @Override
    70      public String[] getArgNames() {
                 /* 
    P/P           *  Method: String[] getArgNames()
                  * 
                  *  Preconditions:
                  *    init'ed(this.argNames)
                  * 
                  *  Postconditions:
                  *    return_value == this.argNames
                  *    init'ed(return_value)
                  */
    71          return argNames;
    72      }
    73      
    74      /** {@inheritDoc} */
    75      @Override
    76      public String getGroup() {
                 /* 
    P/P           *  Method: String getGroup()
                  * 
                  *  Postconditions:
                  *    return_value == &amp;"Query Events"
                  */
    77          return "Query Events";
    78      }    
    79      
    80  }








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