Implemented hashCode() and equals() as it could come in handy if we want to
stick objects in a collection. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4852 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -592,6 +592,31 @@ public class DObject
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override // from Object
|
||||
public String toString ()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
toString(buf);
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
@Override // from Object
|
||||
public int hashCode ()
|
||||
{
|
||||
return _oid;
|
||||
}
|
||||
|
||||
@Override // from Object
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
if (other == null) {
|
||||
return false;
|
||||
} else if (!getClass().equals(other.getClass())) {
|
||||
return false;
|
||||
}
|
||||
return _oid == ((DObject)other).getOid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to briefly describe this distributed object.
|
||||
*/
|
||||
@@ -601,16 +626,6 @@ public class DObject
|
||||
buf.append(":").append(_oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this object.
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
toString(buf);
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this object.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user