KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 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 /**
14  * Node of a refactoring history.
15  *
16  * @since 3.2
17  */

18 public abstract class RefactoringHistoryNode {
19
20     /** The collection kind */
21     public static final int COLLECTION= 11;
22
23     /** The day kind */
24     public static final int DAY= 9;
25
26     /** The entry kind */
27     public static final int ENTRY= 10;
28
29     /** The last month kind */
30     public static final int LAST_MONTH= 5;
31
32     /** The last week kind */
33     public static final int LAST_WEEK= 3;
34
35     /** The month kind */
36     public static final int MONTH= 7;
37
38     /** The project kind */
39     public static final int PROJECT= 12;
40
41     /** The this month kind */
42     public static final int THIS_MONTH= 4;
43
44     /** The this week kind */
45     public static final int THIS_WEEK= 2;
46
47     /** The today kind */
48     public static final int TODAY= 0;
49
50     /** The week kind */
51     public static final int WEEK= 8;
52
53     /** The year kind */
54     public static final int YEAR= 6;
55
56     /** The yesterday kind */
57     public static final int YESTERDAY= 1;
58
59     /**
60      * {@inheritDoc}
61      */

62     public boolean equals(final Object JavaDoc object) {
63         if (object instanceof RefactoringHistoryNode) {
64             final RefactoringHistoryNode node= (RefactoringHistoryNode) object;
65             final RefactoringHistoryNode parent= getParent();
66             if (parent != null) {
67                 if (!parent.equals(node.getParent()))
68                     return false;
69             } else if (node.getParent() != null)
70                 return false;
71             return getKind() == node.getKind();
72         }
73         return false;
74     }
75
76     /**
77      * Returns the node kind.
78      *
79      * @return the node kind
80      */

81     public abstract int getKind();
82
83     /**
84      * Returns the parent node.
85      *
86      * @return the parent node, or <code>null</code>
87      */

88     public abstract RefactoringHistoryNode getParent();
89
90     /**
91      * {@inheritDoc}
92      */

93     public int hashCode() {
94         return (getParent() != null ? getParent().hashCode() : 0) + 31 * getKind();
95     }
96 }
97
Popular Tags