KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > internal > ui > refactoring > history > RefactoringHistoryProject


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.ltk.internal.ui.refactoring.history;
12
13 import org.eclipse.core.runtime.Assert;
14
15 /**
16  * Project of a refactoring history.
17  *
18  * @since 3.2
19  */

20 public final class RefactoringHistoryProject extends RefactoringHistoryNode {
21
22     /** The project */
23     private final String JavaDoc fProject;
24
25     /**
26      * Creates a new refactoring history project.
27      *
28      * @param project
29      */

30     public RefactoringHistoryProject(final String JavaDoc project) {
31         Assert.isNotNull(project);
32         Assert.isTrue(!"".equals(project)); //$NON-NLS-1$
33
fProject= project;
34     }
35
36     /**
37      * {@inheritDoc}
38      */

39     public boolean equals(final Object JavaDoc object) {
40         if (object instanceof RefactoringHistoryProject) {
41             final RefactoringHistoryProject node= (RefactoringHistoryProject) object;
42             return super.equals(object) && getProject().equals(node.getProject()) && getKind() == node.getKind();
43         }
44         return false;
45     }
46
47     /**
48      * {@inheritDoc}
49      */

50     public int getKind() {
51         return PROJECT;
52     }
53
54     /**
55      * {@inheritDoc}
56      */

57     public RefactoringHistoryNode getParent() {
58         return null;
59     }
60
61     /**
62      * Returns the project.
63      *
64      * @return the project
65      */

66     public String JavaDoc getProject() {
67         return fProject;
68     }
69
70     /**
71      * {@inheritDoc}
72      */

73     public int hashCode() {
74         return super.hashCode() + 17 * getKind() + 31 * getProject().hashCode();
75     }
76 }
Popular Tags