1 /*******************************************************************************
2  * Copyright (c) 2005, 2008 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.ltk.internal.ui.refactoring.history;
15 
16 
17 /**
18  * Date node of a refactoring history.
19  *
20  * @since 3.2
21  */
22 public final class RefactoringHistoryDate extends RefactoringHistoryNode {
23 
24 	/** The refactoring history node kind */
25 	private final int fKind;
26 
27 	/** The parent node, or <code>null</code> */
28 	private final RefactoringHistoryNode fParent;
29 
30 	/** The time stamp */
31 	private final long fStamp;
32 
33 	/**
34 	 * Creates a new refactoring history node.
35 	 *
36 	 * @param parent
37 	 *            the parent node, or <code>null</code>
38 	 * @param stamp
39 	 *            the time stamp
40 	 * @param kind
41 	 *            the node kind
42 	 */
RefactoringHistoryDate(final RefactoringHistoryNode parent, final long stamp, final int kind)43 	public RefactoringHistoryDate(final RefactoringHistoryNode parent, final long stamp, final int kind) {
44 		fParent= parent;
45 		fStamp= stamp;
46 		fKind= kind;
47 	}
48 
49 	@Override
equals(final Object object)50 	public boolean equals(final Object object) {
51 		if (object instanceof RefactoringHistoryDate) {
52 			final RefactoringHistoryDate node= (RefactoringHistoryDate) object;
53 			return super.equals(object) && getTimeStamp() == node.getTimeStamp() && getKind() == node.getKind();
54 		}
55 		return false;
56 	}
57 
58 	@Override
getKind()59 	public int getKind() {
60 		return fKind;
61 	}
62 
63 	@Override
getParent()64 	public RefactoringHistoryNode getParent() {
65 		return fParent;
66 	}
67 
68 	/**
69 	 * Returns the time stamp.
70 	 *
71 	 * @return the time stamp
72 	 */
getTimeStamp()73 	public long getTimeStamp() {
74 		return fStamp;
75 	}
76 
77 	@Override
hashCode()78 	public int hashCode() {
79 		return (int) (super.hashCode() + 17 * getKind() + 31 * getTimeStamp());
80 	}
81 }
82