[FIXED HUDSON-5293] added equals() and hashcode() to Dependecy.class so that contains method can work correctly.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@26798 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
sogabe committed 2010-01-31 09:32:00 +00:00
1 parent aa79364f73
commit a25fda149b
1 file changed
+23 -1
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt. Seiji Sogabe
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -433,5 +433,27 @@ public final class DependencyGraph implements Comparator<AbstractProject> {
List<Action> actions) {
return true;
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final Dependency other = (Dependency) obj;
if (this.upstream != other.upstream && (this.upstream == null || !this.upstream.equals(other.upstream)))
return false;
if (this.downstream != other.downstream && (this.downstream == null || !this.downstream.equals(other.downstream)))
return false;
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 23 * hash + (this.upstream != null ? this.upstream.hashCode() : 0);
hash = 23 * hash + (this.downstream != null ? this.downstream.hashCode() : 0);
return hash;
}
}
}