KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > AbstractArtifact


1 /*
2  * This file is subject to the license found in LICENCE.TXT in the root directory of the project.
3  *
4  * #SNAPSHOT#
5  */

6 package fr.jayasoft.ivy;
7
8 import java.util.Map JavaDoc;
9
10 /**
11  * @author Hanin
12  *
13  */

14 public abstract class AbstractArtifact implements Artifact {
15     public AbstractArtifact() {
16     }
17
18     public boolean equals(Object JavaDoc obj) {
19         if (!(obj instanceof Artifact)) {
20             return false;
21         }
22         Artifact art = (Artifact)obj;
23         return getModuleRevisionId().equals(art.getModuleRevisionId())
24             && getPublicationDate()==null?true:getPublicationDate().equals(art.getPublicationDate())
25             && getName().equals(art.getName())
26             && getExt().equals(art.getExt())
27             && getType().equals(art.getType())
28             && getExtraAttributes().equals(art.getExtraAttributes());
29     }
30     
31     public int hashCode() {
32         int hash = 33;
33         hash = hash * 17 + getModuleRevisionId().hashCode();
34         if (getPublicationDate() != null) {
35             hash = hash * 17 + getPublicationDate().hashCode();
36         }
37         hash = hash * 17 + getName().hashCode();
38         hash = hash * 17 + getExt().hashCode();
39         hash = hash * 17 + getType().hashCode();
40         hash = hash * 17 + getExtraAttributes().hashCode();
41         return hash;
42     }
43     
44     public String JavaDoc toString() {
45         return getModuleRevisionId()+"/"+getName()+"."+getExt()+"["+getType()+"]";
46     }
47
48     public String JavaDoc getAttribute(String JavaDoc attName) {
49         return getId().getAttribute(attName);
50     }
51
52     public Map JavaDoc getAttributes() {
53         return getId().getAttributes();
54     }
55
56     public String JavaDoc getExtraAttribute(String JavaDoc attName) {
57         return getId().getExtraAttribute(attName);
58     }
59
60     public Map JavaDoc getExtraAttributes() {
61         return getId().getExtraAttributes();
62     }
63
64     public String JavaDoc getStandardAttribute(String JavaDoc attName) {
65         return getId().getStandardAttribute(attName);
66     }
67
68     public Map JavaDoc getStandardAttributes() {
69         return getId().getStandardAttributes();
70     }
71     
72     
73 }
74
Popular Tags