View Javadoc
1   //////////////////////////////////////////////////////////////////////////////
2   // dexterIM - Instant Messaging Framework
3   // Copyright (C) 2003  Christoph Walcher
4   //
5   // This program is free software; you can redistribute it and/or modify
6   // it under the terms of the GNU General Public License as published by
7   // the Free Software Foundation; either version 2 of the License, or
8   // (at your option) any later version.
9   //
10  // This program is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  // GNU General Public License for more details.
14  //
15  // You should have received a copy of the GNU General Public License
16  // along with this program; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  //////////////////////////////////////////////////////////////////////////////
19  package net.sf.dexterim.core;
20  
21  /***
22   *@author     Christoph Walcher
23   */
24  public class DefaultStatus implements Status {
25    private String code = "";
26    private String name = "";
27  
28    /***
29     *  Creates a new instance of Status
30     */
31    public DefaultStatus() {
32    }
33  
34    /***
35     *  Constructor for the Status object
36     *
37     *@param  name  Description of the Parameter
38     *@param  code  Description of the Parameter
39     *@param  icon  Description of the Parameter
40     */
41    public DefaultStatus(String name, String code) {
42      this.name = name;
43      this.code = code;
44    }
45  
46    /***
47     *  Gets the name attribute of the Status object
48     *
49     *@return    The name value
50     */
51    public String getName() {
52      return name;
53    }
54  
55    /***
56     *  Gets the code attribute of the Status object
57     *
58     *@return    The code value
59     */
60    public String getCode() {
61      return code;
62    }
63  
64    /***
65     *  Description of the Method
66     *
67     *@return    Description of the Return Value
68     */
69    public int hashCode() {
70      return code.hashCode();
71    }
72  
73    /***
74     *  Description of the Method
75     *
76     *@param  obj  Description of the Parameter
77     *@return      Description of the Return Value
78     */
79    public boolean equals(Object obj) {
80      if ((obj != null) && obj instanceof Status) {
81        Status other = (Status)obj;
82  
83        return code.equals(other.getCode());
84      }
85  
86      return false;
87    }
88  
89    /***
90     *  Description of the Method
91     *
92     *@return    Description of the Return Value
93     */
94    public String toString() {
95      return name;
96    }
97  }