Commit | Line | Data |
---|---|---|
e73a4ba5 GB |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 École Polytechnique de Montréal | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are made | |
5 | * available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Geneviève Bastien - Initial implementation and API | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.synchronization; |
e73a4ba5 | 14 | |
2bdf0193 | 15 | import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; |
e73a4ba5 GB |
16 | |
17 | /** | |
18 | * A default simple, identity timestamp transform. It is a singleton class and | |
19 | * returns the timestamp itself | |
20 | * | |
21 | * @author Geneviève Bastien | |
22 | * @since 3.0 | |
9ffcda7d GB |
23 | * @deprecated This class has been moved to internal. Use one of |
24 | * {@link TimestampTransformFactory} methods to create the timestamp | |
25 | * transform. For the identity, use | |
26 | * {@link TimestampTransformFactory#getDefaultTransform()} | |
e73a4ba5 | 27 | */ |
9ffcda7d | 28 | @Deprecated |
ef49aa36 | 29 | public class TmfTimestampTransform implements ITmfTimestampTransform { |
e73a4ba5 GB |
30 | |
31 | /** | |
32 | * Generated serial UID | |
33 | */ | |
34 | private static final long serialVersionUID = -1480581417493073304L; | |
35 | ||
36 | /** | |
37 | * The unique instance of this transform, since it is always the same | |
38 | */ | |
39 | public static final TmfTimestampTransform IDENTITY = new TmfTimestampTransform(); | |
40 | ||
41 | /** | |
42 | * Default constructor | |
43 | */ | |
44 | protected TmfTimestampTransform() { | |
45 | ||
46 | } | |
47 | ||
48 | @Override | |
49 | public ITmfTimestamp transform(ITmfTimestamp timestamp) { | |
50 | return timestamp; | |
51 | } | |
52 | ||
53 | @Override | |
54 | public long transform(long timestamp) { | |
55 | return timestamp; | |
56 | } | |
57 | ||
58 | @Override | |
59 | public ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith) { | |
60 | /* Since this transform will not modify anything, return the other */ | |
61 | return composeWith; | |
62 | } | |
63 | ||
64 | @Override | |
65 | public boolean equals(Object other) { | |
66 | return other.getClass().equals(TmfTimestampTransform.class); | |
67 | } | |
68 | ||
69 | @Override | |
70 | public int hashCode() { | |
71 | final int prime = 31; | |
72 | int result = 1; | |
73 | result = (prime * result) + TmfTimestampTransform.class.hashCode(); | |
74 | return result; | |
75 | } | |
76 | ||
77 | @Override | |
78 | public String toString() { | |
79 | return "TmfTimestampTransform [ IDENTITY ]"; //$NON-NLS-1$ | |
80 | } | |
81 | ||
82 | } |