KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > tribe > common > Member


1 /**
2  * Tribe: Group communication library.
3  * Copyright (C) 2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: tribe@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): Nicolas Modrzyk.
23  */

24
25 package org.objectweb.tribe.common;
26
27 import java.io.Serializable JavaDoc;
28
29 /**
30  * This class defines a group Member.
31  *
32  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
33  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
34  * @version 1.0
35  */

36 public class Member implements Serializable JavaDoc
37 {
38   private Address address;
39   private String JavaDoc uid;
40
41   /**
42    * Creates a new <code>Member</code> object
43    *
44    * @param address member address
45    * @param uid member unique identifier
46    */

47   public Member(Address address, String JavaDoc uid)
48   {
49     this.address = address;
50     this.uid = uid;
51   }
52
53   /**
54    * Returns the address value.
55    *
56    * @return Returns the address.
57    */

58   public Address getAddress()
59   {
60     return address;
61   }
62
63   /**
64    * Sets the address value.
65    *
66    * @param address The address to set.
67    */

68   public void setAddress(Address address)
69   {
70     this.address = address;
71   }
72
73   /**
74    * Returns the uid value.
75    *
76    * @return Returns the uid.
77    */

78   public String JavaDoc getUid()
79   {
80     return uid;
81   }
82
83   /**
84    * Sets the uid value.
85    *
86    * @param uid The uid to set.
87    */

88   public void setUid(String JavaDoc uid)
89   {
90     this.uid = uid;
91   }
92
93   /**
94    * @see java.lang.Object#equals(java.lang.Object)
95    */

96   public boolean equals(Object JavaDoc obj)
97   {
98     if (obj instanceof Member)
99     {
100       Member m = (Member) obj;
101       return uid.equals(m.uid) && address.equals(m.address);
102     }
103     return false;
104   }
105
106   /**
107    * @see java.lang.Object#hashCode()
108    */

109   public int hashCode()
110   {
111     return uid.hashCode() + address.hashCode();
112   }
113
114   /**
115    * @see java.lang.Object#toString()
116    */

117   public String JavaDoc toString()
118   {
119     return uid + "[" + address + "]";
120   }
121
122 }
Popular Tags