o Overriding hashCode() and equals().

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163306 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Trygve Laugstol 2005-01-13 09:37:44 +00:00
parent 3143fbd731
commit 2520812edf
1 changed files with 24 additions and 5 deletions

View File

@ -122,11 +122,6 @@ public class DefaultArtifact
//
// ----------------------------------------------------------------------
public String toString()
{
return getId();
}
public String getId()
{
return getGroupId() + ":" +
@ -141,4 +136,28 @@ public class DefaultArtifact
getArtifactId() + ":" +
getType();
}
// ----------------------------------------------------------------------
// Object overrides
// ----------------------------------------------------------------------
public String toString()
{
return getId();
}
public int hashCode()
{
return getId().hashCode();
}
public boolean equals( Object o )
{
Artifact other = (Artifact) o;
return this.groupId.equals( other.getGroupId() ) &&
this.artifactId.equals( other.getArtifactId() ) &&
this.version.equals( other.getVersion() ) &&
this.type.equals( other.getType() );
}
}