Added working hashCode() and equals().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1714 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Credentials.java,v 1.8 2002/07/23 05:52:48 mdb Exp $
|
// $Id: Credentials.java,v 1.9 2002/09/18 21:58:30 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.presents.net;
|
package com.threerings.presents.net;
|
||||||
|
|
||||||
@@ -66,6 +66,22 @@ public abstract class Credentials implements Streamable
|
|||||||
_username = in.readUTF();
|
_username = in.readUTF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public int hashCode ()
|
||||||
|
{
|
||||||
|
return _username.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public boolean equals (Object other)
|
||||||
|
{
|
||||||
|
if (other instanceof Credentials) {
|
||||||
|
return _username.equals(((Credentials)other)._username);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String toString ()
|
public String toString ()
|
||||||
{
|
{
|
||||||
return "[username=" + _username + "]";
|
return "[username=" + _username + "]";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: UsernamePasswordCreds.java,v 1.7 2002/07/23 05:52:49 mdb Exp $
|
// $Id: UsernamePasswordCreds.java,v 1.8 2002/09/18 21:58:30 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.presents.net;
|
package com.threerings.presents.net;
|
||||||
|
|
||||||
@@ -52,6 +52,25 @@ public class UsernamePasswordCreds extends Credentials
|
|||||||
_password = in.readUTF();
|
_password = in.readUTF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public int hashCode ()
|
||||||
|
{
|
||||||
|
return super.hashCode() ^ _password.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public boolean equals (Object other)
|
||||||
|
{
|
||||||
|
if (other instanceof UsernamePasswordCredentials) {
|
||||||
|
UsernamePasswordCredentials upcreds =
|
||||||
|
(UsernamePasswordCredentials)other;
|
||||||
|
return super.equals(other) &&
|
||||||
|
_password.equals(upcreds._password);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String toString ()
|
public String toString ()
|
||||||
{
|
{
|
||||||
return "[username=" + _username + ", password=" + _password + "]";
|
return "[username=" + _username + ", password=" + _password + "]";
|
||||||
|
|||||||
Reference in New Issue
Block a user