1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.dexterim.core;
20
21 /***
22 *@author Christoph Walcher
23 */
24 public abstract class AbstractContact implements Contact {
25 private String nick;
26 private String account;
27 private String status;
28 private java.util.Map properties;
29
30 /***
31 * Creates a new instance of DefaultContact
32 */
33 public AbstractContact() {
34 this(null, null, null);
35 }
36
37 /***
38 * Constructor for the AbstractContact object
39 *
40 *@param account Description of the Parameter
41 *@param nick Description of the Parameter
42 *@param status Description of the Parameter
43 */
44 public AbstractContact(String account, String nick, String status) {
45 this.nick = nick;
46 this.account = account;
47 this.status = status;
48
49 this.properties = new java.util.HashMap();
50 }
51
52 /***
53 * Gets the nick attribute of the AbstractContact object
54 *
55 *@return The nick value
56 */
57 public String getNick() {
58 return nick;
59 }
60
61 /***
62 * Gets the account attribute of the AbstractContact object
63 *
64 *@return The account value
65 */
66 public String getAccount() {
67 return account;
68 }
69
70 /***
71 * Gets the status attribute of the AbstractContact object
72 *
73 *@return The status value
74 */
75 public String getStatus() {
76 return status;
77 }
78
79 /***
80 * Sets the nick attribute of the AbstractContact object
81 *
82 *@param nick The new nick value
83 */
84 public void setNick(String nick) {
85 this.nick = nick;
86 }
87
88 /***
89 * Sets the status attribute of the AbstractContact object
90 *
91 *@param status The new status value
92 */
93 public void setStatus(String status) {
94 this.status = status;
95 }
96
97 /***
98 * Gets the value attribute of the AbstractContact object
99 *
100 *@param key Description of the Parameter
101 *@return The value value
102 */
103 public Object getValue(Object key) {
104 return properties.get(key);
105 }
106
107 /***
108 * Description of the Method
109 *
110 *@return Description of the Return Value
111 */
112 public int hashCode() {
113 return getIdentity().hashCode();
114 }
115
116 /***
117 * Description of the Method
118 *
119 *@return Description of the Return Value
120 */
121 public String toString() {
122 if (nick != null) {
123 return nick;
124 }
125 else {
126 return account;
127 }
128 }
129
130 /***
131 * Description of the Method
132 *
133 *@param obj Description of the Parameter
134 *@return Description of the Return Value
135 */
136 public boolean equals(Object obj) {
137 if ((obj != null) && obj instanceof Contact) {
138 return getIdentity().equals(((Contact)obj).getIdentity());
139 }
140
141 return false;
142 }
143 }