Commit | Line | Data |
---|---|---|
8c8bf09f ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009, 2010 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made 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 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
9e0640dc | 13 | package org.eclipse.linuxtools.internal.tmf.core.trace; |
8c8bf09f | 14 | |
6c13869b FC |
15 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; |
16 | import org.eclipse.linuxtools.tmf.core.trace.TmfContext; | |
8c8bf09f ASL |
17 | |
18 | /** | |
19 | * <b><u>TmfExperimentCheckpoint</u></b> | |
20 | * <p> | |
21 | * TODO: Implement me. Please. | |
22 | */ | |
23 | public class TmfExperimentCheckpoint implements Comparable<TmfExperimentCheckpoint> { | |
24 | ||
25 | // ------------------------------------------------------------------------ | |
26 | // Attributes | |
27 | // ------------------------------------------------------------------------ | |
28 | ||
29 | private final TmfTimestamp fTimestamp; | |
9f584e4c | 30 | private final TmfContext[] fContexts; |
8c8bf09f ASL |
31 | |
32 | // ------------------------------------------------------------------------ | |
33 | // Constructors | |
34 | // ------------------------------------------------------------------------ | |
35 | ||
36 | /** | |
0d9a6d76 FC |
37 | * @param ts the checkpoint timestamp |
38 | * @param contexts the corresponding set of trace contexts | |
8c8bf09f | 39 | */ |
9f584e4c | 40 | public TmfExperimentCheckpoint(TmfTimestamp ts, TmfContext[] contexts) { |
8c8bf09f ASL |
41 | fTimestamp = ts; |
42 | fContexts = contexts; | |
43 | } | |
44 | ||
45 | // ------------------------------------------------------------------------ | |
46 | // Accessors | |
47 | // ------------------------------------------------------------------------ | |
48 | ||
49 | /** | |
50 | * @return the checkpoint event timestamp | |
51 | */ | |
52 | public TmfTimestamp getTimestamp() { | |
53 | return fTimestamp; | |
54 | } | |
55 | ||
56 | /** | |
57 | * @return the checkpoint event stream location | |
58 | */ | |
9f584e4c | 59 | public TmfContext[] getContexts() { |
8c8bf09f ASL |
60 | return fContexts; |
61 | } | |
62 | ||
cbd4ad82 FC |
63 | // ------------------------------------------------------------------------ |
64 | // Object | |
65 | // ------------------------------------------------------------------------ | |
66 | ||
67 | @Override | |
68 | public int hashCode() { | |
69 | int result = 37; | |
70 | result = 17 * result + fTimestamp.hashCode(); | |
71 | return result; | |
72 | } | |
73 | ||
74 | @Override | |
75 | public boolean equals(Object other) { | |
76 | if (!(other instanceof TmfExperimentCheckpoint)) { | |
77 | return false; | |
78 | } | |
79 | TmfExperimentCheckpoint o = (TmfExperimentCheckpoint) other; | |
80 | return fTimestamp.equals(o.fTimestamp); | |
81 | } | |
82 | ||
8c8bf09f ASL |
83 | // ------------------------------------------------------------------------ |
84 | // Comparable | |
85 | // ------------------------------------------------------------------------ | |
86 | ||
d4011df2 | 87 | @Override |
8c8bf09f ASL |
88 | public int compareTo(TmfExperimentCheckpoint other) { |
89 | return fTimestamp.compareTo(other.fTimestamp, false); | |
90 | } | |
91 | ||
92 | } |