Move alltests plugin to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / trace / TmfExperimentCheckpoint.java
CommitLineData
8c8bf09f 1/*******************************************************************************
61759503 2 * Copyright (c) 2009, 2013 Ericsson
83f4e378 3 *
8c8bf09f
ASL
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
83f4e378 8 *
8c8bf09f
ASL
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
9e0640dc 13package org.eclipse.linuxtools.internal.tmf.core.trace;
8c8bf09f 14
3bd46eef 15import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
6c13869b 16import 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 */
23public class TmfExperimentCheckpoint implements Comparable<TmfExperimentCheckpoint> {
24
25 // ------------------------------------------------------------------------
26 // Attributes
27 // ------------------------------------------------------------------------
83f4e378 28
8c8bf09f 29 private final TmfTimestamp fTimestamp;
408e65d2 30 private final long[] fRanks;
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 */
83f4e378 40 public TmfExperimentCheckpoint(final TmfTimestamp ts, final TmfContext[] contexts) {
8c8bf09f 41 fTimestamp = ts;
408e65d2
FC
42 fRanks = new long[contexts.length];
43 for (int i = 0; i < fRanks.length; i++) {
44 fRanks[i] = contexts[i].getRank();
45 }
8c8bf09f
ASL
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 /**
408e65d2 60 * @return the checkpoint event rank
8c8bf09f 61 */
408e65d2
FC
62 public long[] getRanks() {
63 return fRanks;
8c8bf09f
ASL
64 }
65
cbd4ad82
FC
66 // ------------------------------------------------------------------------
67 // Object
68 // ------------------------------------------------------------------------
69
70 @Override
71 public int hashCode() {
d5efe032
AF
72 int result = 37;
73 result = 17 * result + fTimestamp.hashCode();
74 return result;
cbd4ad82 75 }
83f4e378 76
cbd4ad82 77 @Override
83f4e378 78 public boolean equals(final Object other) {
d5efe032
AF
79 if (!(other instanceof TmfExperimentCheckpoint)) {
80 return false;
81 }
82 final TmfExperimentCheckpoint o = (TmfExperimentCheckpoint) other;
83 return fTimestamp.equals(o.fTimestamp);
cbd4ad82 84 }
83f4e378 85
8c8bf09f
ASL
86 // ------------------------------------------------------------------------
87 // Comparable
88 // ------------------------------------------------------------------------
89
d5efe032
AF
90 @Override
91 public int compareTo(final TmfExperimentCheckpoint other) {
92 return fTimestamp.compareTo(other.fTimestamp, false);
93 }
8c8bf09f
ASL
94
95}
This page took 0.065821 seconds and 5 git commands to generate.