KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
15  * Date node of a refactoring history.
16  *
17  * @since 3.2
18  */

19 public final class RefactoringHistoryDate extends RefactoringHistoryNode {
20
21     /** The refactoring history node kind */
22     private final int fKind;
23
24     /** The parent node, or <code>null</code> */
25     private final RefactoringHistoryNode fParent;
26
27     /** The time stamp */
28     private final long fStamp;
29
30     /**
31      * Creates a new refactoring history node.
32      *
33      * @param parent
34      * the parent node, or <code>null</code>
35      * @param stamp
36      * the time stamp
37      * @param kind
38      * the node kind
39      */

40     public RefactoringHistoryDate(final RefactoringHistoryNode parent, final long stamp, final int kind) {
41         fParent= parent;
42         fStamp= stamp;
43         fKind= kind;
44     }
45
46     /**
47      * {@inheritDoc}
48      */

49     public boolean equals(final Object JavaDoc object) {
50         if (object instanceof RefactoringHistoryDate) {
51             final RefactoringHistoryDate node= (RefactoringHistoryDate) object;
52             return super.equals(object) && getTimeStamp() == node.getTimeStamp() && getKind() == node.getKind();
53         }
54         return false;
55     }
56
57     /**
58      * {@inheritDoc}
59      */

60     public int getKind() {
61         return fKind;
62     }
63
64     /**
65      * {@inheritDoc}
66      */

67     public RefactoringHistoryNode getParent() {
68         return fParent;
69     }
70
71     /**
72      * Returns the time stamp.
73      *
74      * @return the time stamp
75      */

76     public long getTimeStamp() {
77         return fStamp;
78     }
79
80     /**
81      * {@inheritDoc}
82      */

83     public int hashCode() {
84         return (int) (super.hashCode() + 17 * getKind() + 31 * getTimeStamp());
85     }
86 }
87
Popular Tags