KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > core > URLKey


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.update.internal.core;
12  
13 import java.net.*;
14
15
16
17 /**
18  *
19  *
20  */

21 public class URLKey {
22
23     private URL url;
24     
25     /**
26      * Constructor for URLKey.
27      */

28     public URLKey(URL url) {
29         super();
30         this.url = url;
31     }
32
33     /**
34      * @see java.lang.Object#equals(Object)
35      */

36     public boolean equals(Object JavaDoc obj) {
37             if (obj == null) {
38                 return false;
39             }
40
41             if (this == obj) {
42                 return true;
43             }
44
45             if (obj instanceof URLKey) {
46                 return equals(((URLKey) obj).getURL());
47             }
48
49             if (!(obj instanceof URL)) {
50                 return false;
51             }
52
53             URL url2 = (URL)obj;
54             if (url == url2) {
55                 return true;
56             }
57
58             return UpdateManagerUtils.sameURL(url,url2);
59     }
60
61     /**
62      * @see java.lang.Object#hashCode()
63      */

64     public int hashCode() {
65         return url.hashCode();
66     }
67
68     /**
69      * Returns the url.
70      * @return URL
71      */

72     public URL getURL() {
73         return url;
74     }
75
76 }
77
Popular Tags