Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3ad21c5a013f35777a637ab5bd07f67ff77c529b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
 * Copyright (c) 2013 École Polytechnique de Montréal
 *
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Geneviève Bastien - Initial implementation and API
 *******************************************************************************/

package org.eclipse.tracecompass.tmf.core.synchronization;

import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;

/**
 * A default simple, identity timestamp transform. It is a singleton class and
 * returns the timestamp itself
 *
 * @author Geneviève Bastien
 * @since 3.0
 * @deprecated This class has been moved to internal. Use one of
 *             {@link TimestampTransformFactory} methods to create the timestamp
 *             transform. For the identity, use
 *             {@link TimestampTransformFactory#getDefaultTransform()}
 */
@Deprecated
public class TmfTimestampTransform implements ITmfTimestampTransform {

    /**
     * Generated serial UID
     */
    private static final long serialVersionUID = -1480581417493073304L;

    /**
     * The unique instance of this transform, since it is always the same
     */
    public static final TmfTimestampTransform IDENTITY = new TmfTimestampTransform();

    /**
     * Default constructor
     */
    protected TmfTimestampTransform() {

    }

    @Override
    public ITmfTimestamp transform(ITmfTimestamp timestamp) {
        return timestamp;
    }

    @Override
    public long transform(long timestamp) {
        return timestamp;
    }

    @Override
    public ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith) {
        /* Since this transform will not modify anything, return the other */
        return composeWith;
    }

    @Override
    public boolean equals(Object other) {
        return other.getClass().equals(TmfTimestampTransform.class);
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (prime * result) + TmfTimestampTransform.class.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "TmfTimestampTransform [ IDENTITY ]"; //$NON-NLS-1$
    }

}

Back to the top