tmf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / trace / TmfExperimentCheckpoint.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 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
13 package org.eclipse.linuxtools.internal.tmf.core.trace;
14
15 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
16 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
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;
30 private final long[] fRanks;
31
32 // ------------------------------------------------------------------------
33 // Constructors
34 // ------------------------------------------------------------------------
35
36 /**
37 * @param ts the checkpoint timestamp
38 * @param contexts the corresponding set of trace contexts
39 */
40 public TmfExperimentCheckpoint(final TmfTimestamp ts, final TmfContext[] contexts) {
41 fTimestamp = ts;
42 fRanks = new long[contexts.length];
43 for (int i = 0; i < fRanks.length; i++) {
44 fRanks[i] = contexts[i].getRank();
45 }
46 }
47
48 // ------------------------------------------------------------------------
49 // Accessors
50 // ------------------------------------------------------------------------
51
52 /**
53 * @return the checkpoint event timestamp
54 */
55 public TmfTimestamp getTimestamp() {
56 return fTimestamp;
57 }
58
59 /**
60 * @return the checkpoint event rank
61 */
62 public long[] getRanks() {
63 return fRanks;
64 }
65
66 // ------------------------------------------------------------------------
67 // Object
68 // ------------------------------------------------------------------------
69
70 @Override
71 public int hashCode() {
72 int result = 37;
73 result = 17 * result + fTimestamp.hashCode();
74 return result;
75 }
76
77 @Override
78 public boolean equals(final Object other) {
79 if (!(other instanceof TmfExperimentCheckpoint)) {
80 return false;
81 }
82 final TmfExperimentCheckpoint o = (TmfExperimentCheckpoint) other;
83 return fTimestamp.equals(o.fTimestamp);
84 }
85
86 // ------------------------------------------------------------------------
87 // Comparable
88 // ------------------------------------------------------------------------
89
90 @Override
91 public int compareTo(final TmfExperimentCheckpoint other) {
92 return fTimestamp.compareTo(other.fTimestamp, false);
93 }
94
95 }
This page took 0.037029 seconds and 5 git commands to generate.