ItEr19S08CUCreacionProxectoPlanificacionItEr18S08: Taking into account the type when calculating if a Dependency is equal to another.
This commit is contained in:
parent
d78738e11d
commit
0e023365ba
2 changed files with 12 additions and 17 deletions
|
|
@ -22,6 +22,10 @@
|
|||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<!-- ZK -->
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package org.zkoss.ganttz.data;
|
|||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* This class represents a dependency. Contains the source and the destination.
|
||||
* It also specifies the type of the relationship. <br/>
|
||||
|
|
@ -74,12 +77,8 @@ public class Dependency {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((destination == null) ? 0 : destination.hashCode());
|
||||
result = prime * result + ((source == null) ? 0 : source.hashCode());
|
||||
return result;
|
||||
return new HashCodeBuilder().append(source).append(destination).append(
|
||||
type).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -91,17 +90,9 @@ public class Dependency {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Dependency other = (Dependency) obj;
|
||||
if (destination == null) {
|
||||
if (other.destination != null)
|
||||
return false;
|
||||
} else if (!destination.equals(other.destination))
|
||||
return false;
|
||||
if (source == null) {
|
||||
if (other.source != null)
|
||||
return false;
|
||||
} else if (!source.equals(other.source))
|
||||
return false;
|
||||
return true;
|
||||
return new EqualsBuilder().append(this.destination, other.destination)
|
||||
.append(this.source, other.source)
|
||||
.append(this.type, other.type).isEquals();
|
||||
}
|
||||
|
||||
public Task getSource() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue