[jboss-svn-commits] JBL Code SVN: r9377 - labs/jbossrules/trunk/drools-jsr94/src/test/java/org/drools/jsr94/rules.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Feb 6 15:31:29 EST 2007
Author: mark.proctor at jboss.com
Date: 2007-02-06 15:31:28 -0500 (Tue, 06 Feb 2007)
New Revision: 9377
Modified:
labs/jbossrules/trunk/drools-jsr94/src/test/java/org/drools/jsr94/rules/Person.java
Log:
-Fixed Person.equals(..)
Modified: labs/jbossrules/trunk/drools-jsr94/src/test/java/org/drools/jsr94/rules/Person.java
===================================================================
--- labs/jbossrules/trunk/drools-jsr94/src/test/java/org/drools/jsr94/rules/Person.java 2007-02-06 20:09:36 UTC (rev 9376)
+++ labs/jbossrules/trunk/drools-jsr94/src/test/java/org/drools/jsr94/rules/Person.java 2007-02-06 20:31:28 UTC (rev 9377)
@@ -49,6 +49,10 @@
private Set sisters;
+ public Person() {
+
+ }
+
public Person(final String name) {
this.name = name;
this.sisters = new HashSet();
@@ -69,4 +73,30 @@
public String toString() {
return this.name;
}
+
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+ result = PRIME * result + ((sisters == null) ? 0 : sisters.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if ( this == obj ) return true;
+ if ( obj == null ) return false;
+
+ if ( !(obj instanceof Person) ) return false;
+ final Person other = (Person) obj;
+
+ if ( name == null ) {
+ if ( other.name != null ) return false;
+ } else if ( !name.equals( other.name ) ) return false;
+ if ( sisters == null ) {
+ if ( other.sisters != null ) return false;
+ } else if ( !sisters.equals( other.sisters ) ) return false;
+ return true;
+ }
+
+
}
More information about the jboss-svn-commits
mailing list