KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > context > ContextFile


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.help.internal.context;
12
13 /*
14  * A reference to a context XML file, or more precisely, a set of files, one
15  * for each locale.
16  */

17 public class ContextFile {
18
19     private String JavaDoc bundleId;
20     private String JavaDoc file;
21     
22     /*
23      * Creates a new context file reference.
24      */

25     public ContextFile(String JavaDoc bundleId, String JavaDoc file) {
26         this.bundleId = bundleId;
27         this.file = file;
28     }
29
30     /*
31      * Return the id of the bundle containing the file, e.g. "org.eclipse.help"
32      */

33     public String JavaDoc getBundleId() {
34         return bundleId;
35     }
36
37     /*
38      * Returns the bundle-relative path to the file, e.g. "/path/contexts.xml"
39      */

40     public String JavaDoc getFile() {
41         return file;
42     }
43     
44     /* (non-Javadoc)
45      * @see java.lang.Object#equals(java.lang.Object)
46      */

47     public boolean equals(Object JavaDoc obj) {
48         if (obj instanceof ContextFile) {
49             if (obj == this) {
50                 return true;
51             }
52             return bundleId.equals(((ContextFile)obj).bundleId) && file.equals(((ContextFile)obj).file);
53         }
54         return false;
55     }
56     
57     /* (non-Javadoc)
58      * @see java.lang.Object#hashCode()
59      */

60     public int hashCode() {
61         return bundleId.hashCode() + file.hashCode();
62     }
63 }
64
Popular Tags