1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tmf
.core
.trace
.experiment
;
15 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimestamp
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfContext
;
19 * <b><u>TmfExperimentCheckpoint</u></b>
21 * TODO: Implement me. Please.
23 public class TmfExperimentCheckpoint
implements Comparable
<TmfExperimentCheckpoint
> {
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
29 private final TmfTimestamp fTimestamp
;
30 private final long[] fRanks
;
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
37 * @param ts the checkpoint timestamp
38 * @param contexts the corresponding set of trace contexts
40 public TmfExperimentCheckpoint(final TmfTimestamp ts
, final TmfContext
[] contexts
) {
42 fRanks
= new long[contexts
.length
];
43 for (int i
= 0; i
< fRanks
.length
; i
++) {
44 fRanks
[i
] = contexts
[i
].getRank();
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 * @return the checkpoint event timestamp
55 public TmfTimestamp
getTimestamp() {
60 * @return the checkpoint event rank
62 public long[] getRanks() {
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
71 public int hashCode() {
73 result
= 17 * result
+ fTimestamp
.hashCode();
78 public boolean equals(final Object other
) {
79 if (!(other
instanceof TmfExperimentCheckpoint
)) {
82 final TmfExperimentCheckpoint o
= (TmfExperimentCheckpoint
) other
;
83 return fTimestamp
.equals(o
.fTimestamp
);
86 // ------------------------------------------------------------------------
88 // ------------------------------------------------------------------------
91 public int compareTo(final TmfExperimentCheckpoint other
) {
92 return fTimestamp
.compareTo(other
.fTimestamp
);