From 7b24a1b606172354984f5ae7487cdb746072b552 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 13 Jul 2004 10:39:37 +0000 Subject: [PATCH] Implement equals() and hashCode(). --- .../com/threerings/getdown/data/Resource.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/getdown/data/Resource.java b/src/java/com/threerings/getdown/data/Resource.java index 2054613..e666e5e 100644 --- a/src/java/com/threerings/getdown/data/Resource.java +++ b/src/java/com/threerings/getdown/data/Resource.java @@ -1,5 +1,5 @@ // -// $Id: Resource.java,v 1.6 2004/07/07 16:17:01 mdb Exp $ +// $Id: Resource.java,v 1.7 2004/07/13 10:39:37 mdb Exp $ package com.threerings.getdown.data; @@ -130,6 +130,26 @@ public class Resource } } + /** + * If our path is equal, we are equal. + */ + public boolean equals (Object other) + { + if (other instanceof Resource) { + return _path.equals(((Resource)other)._path); + } else { + return false; + } + } + + /** + * We hash on our path. + */ + public int hashCode () + { + return _path.hashCode(); + } + /** * Returns a string representation of this instance. */