KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > properties > ResourceName


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.core.internal.properties;
12
13 import org.eclipse.core.runtime.IPath;
14
15 public class ResourceName {
16     protected String JavaDoc qualifier = null;
17     protected IPath path = null;
18
19     public ResourceName(String JavaDoc qualifier, IPath path) {
20         super();
21         this.qualifier = qualifier;
22         this.path = path;
23     }
24
25     public boolean equals(Object JavaDoc other) {
26         if (this == other)
27             return true;
28         if (!(other instanceof ResourceName))
29             return false;
30         ResourceName otherName = (ResourceName) other;
31         if (qualifier == null) {
32             if (otherName.getQualifier() != null)
33                 return false;
34         } else if (!qualifier.equals(otherName.getQualifier()))
35             return false;
36         return path.equals(otherName.getPath());
37     }
38
39     public IPath getPath() {
40         return path;
41     }
42
43     public String JavaDoc getQualifier() {
44         return qualifier;
45     }
46
47     public int hashCode() {
48         return path.hashCode();
49     }
50
51     public String JavaDoc toString() {
52         return getQualifier() + " " + getPath().toString(); //$NON-NLS-1$
53
}
54 }
55
Popular Tags