KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > tool > archive > Module


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  * Paul Mahar
22  *
23  */

24 package org.enhydra.tool.archive;
25
26 // ToolBox
27
import org.enhydra.tool.common.PathHandle;
28
29 //
30
public class Module {
31     private String JavaDoc name = null;
32     private String JavaDoc archive = null;
33
34     public Module(String JavaDoc filepath) {
35         PathHandle ph = PathHandle.createPathHandle(filepath);
36
37         setName(ph.getFile().getName());
38         setArchive(ph.getPath());
39     }
40
41     public String JavaDoc getArchive() {
42         return archive;
43     }
44
45     public void setArchive(String JavaDoc a) {
46         archive = a;
47     }
48
49     public String JavaDoc getName() {
50         return name;
51     }
52
53     // override Object
54
public boolean equals(Object JavaDoc obj) {
55         boolean equal = false;
56
57         if (obj instanceof Module) {
58             Module mod = (Module) obj;
59
60             if (mod.getName().equals(getName())) {
61                 equal = true;
62             }
63             if (equal) {
64                 if (!mod.getArchive().equals(getArchive())) {
65                     equal = false;
66                 }
67             }
68         }
69         return equal;
70     }
71
72     private void setName(String JavaDoc n) {
73         name = n;
74     }
75
76 }
77
Popular Tags