[MOBY-guts] biomoby commit

Paul Gordon gordonp at pub.open-bio.org
Tue Apr 5 15:14:53 UTC 2005


gordonp
Tue Apr  5 11:14:53 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory pub.open-bio.org:/tmp/cvs-serv24095/org/biomoby/shared

Modified Files:
	MobyDataSimpleInstance.java 
Log Message:
Changed equals() to use underlying Java equals() rather than reference comparison (momentary lapse of reason in initial version)

moby-live/Java/src/main/org/biomoby/shared MobyDataSimpleInstance.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSimpleInstance.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSimpleInstance.java	2005/04/04 17:42:17	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSimpleInstance.java	2005/04/05 15:14:53	1.6
@@ -100,13 +100,16 @@
      * will be used for the comparison.  The namespace and ID are ignored,
      * only the value is compared (such as a MobyDataInteger or Integer or 
      * BigInteger vs. a MobyDataInteger). 
+     *
+     * @return true if the values are equals according to the underlying Java object's equals() method
+     * @throws ClassCastException if and only if a child class or underlying Java object decides the comparison classes are invalid 
      */
-    public boolean equals(Object passedInObject){
+    public boolean equals(Object passedInObject) throws ClassCastException{
       Object ourObject = getObject();
       if(passedInObject != null && passedInObject instanceof MobyDataSimpleInstance){
         passedInObject = ((MobyDataSimpleInstance) passedInObject).getObject();
       }
-      return ourObject == passedInObject;
+      return ourObject.equals(passedInObject);
     }
 
     /**




More information about the MOBY-guts mailing list