KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
9  * Identifies an artifact in a module, without revision information
10  */

11 public class ArtifactId {
12     private ModuleId _mid;
13     private String JavaDoc _name;
14     private String JavaDoc _type;
15     private String JavaDoc _ext;
16     
17     
18     /**
19      * @param mid
20      * @param name
21      * @param type
22      */

23     public ArtifactId(ModuleId mid, String JavaDoc name, String JavaDoc type, String JavaDoc ext) {
24         _mid = mid;
25         _name = name;
26         _type = type;
27         _ext = ext;
28     }
29     
30     public boolean equals(Object JavaDoc obj) {
31         if (! (obj instanceof ArtifactId)) {
32             return false;
33         }
34         ArtifactId aid = (ArtifactId)obj;
35         return getModuleId().equals(aid.getModuleId())
36             && getName().equals(aid.getName())
37             && getExt().equals(aid.getExt())
38             && getType().equals(aid.getType());
39     }
40     
41     public int hashCode() {
42         int hash = 17;
43         hash += getModuleId().hashCode() * 37;
44         hash += getName().hashCode() * 37;
45         hash += getType().hashCode() * 37;
46         return hash;
47     }
48     
49     public String JavaDoc toString() {
50         return getModuleId()+" "+getName()+"."+getType();
51     }
52     
53     /**
54      * @return Returns the module id.
55      */

56     public ModuleId getModuleId() {
57         return _mid;
58     }
59     /**
60      * @return Returns the name.
61      */

62     public String JavaDoc getName() {
63         return _name;
64     }
65     /**
66      * @return Returns the type.
67      */

68     public String JavaDoc getType() {
69         return _type;
70     }
71     /**
72      * @return Returns the ext.
73      */

74     public String JavaDoc getExt() {
75         return _ext;
76     }
77 }
78
Popular Tags