2010-11-09 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug315307
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / experiment / TmfExperimentLocation.java
CommitLineData
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
13package org.eclipse.linuxtools.tmf.experiment;
14
15import org.eclipse.linuxtools.tmf.trace.ITmfLocation;
452ad365 16import org.eclipse.linuxtools.tmf.trace.TmfLocation;
8c8bf09f
ASL
17
18/**
19 * <b><u>TmfExperimentLocation</u></b>
20 * <p>
21 * The experiment location is the set of its traces' locations.
22 */
452ad365 23public class TmfExperimentLocation extends TmfLocation<ITmfLocation<?>[]> {
8c8bf09f 24
8f50c396
FC
25 private long[] fRanks;
26
27 public TmfExperimentLocation(ITmfLocation<?>[] locations, long[] ranks) {
452ad365 28 super(locations);
8f50c396 29 fRanks = ranks;
8c8bf09f
ASL
30 }
31
17c0074a 32 @Override
8c8bf09f 33 public TmfExperimentLocation clone() {
2fb2eb37 34 super.clone(); // To keep FindBugs happy
452ad365
FC
35 ITmfLocation<?>[] locations = (ITmfLocation<?>[]) getLocation();
36 ITmfLocation<?>[] clones = new ITmfLocation[locations.length];
37 for (int i = 0; i < locations.length; i++) {
38 clones[i] = locations[i].clone();
8c8bf09f 39 }
8f50c396 40 return new TmfExperimentLocation(clones, fRanks.clone());
8c8bf09f
ASL
41 }
42
9b635e61 43 @Override
3b38ea61 44 @SuppressWarnings("nls")
9b635e61
FC
45 public String toString() {
46 StringBuilder result = new StringBuilder("[TmfExperimentLocation");
47 ITmfLocation<?>[] locations = (ITmfLocation<?>[]) getLocation();
48 for (int i = 0; i < locations.length; i++) {
49 result.append("[" + locations[i].toString() + "," + fRanks[i] + "]");
50 }
51 result.append("]");
52 return result.toString();
53 }
54
8f50c396
FC
55 public long[] getRanks() {
56 return fRanks;
57 }
8c8bf09f 58}
This page took 0.037775 seconds and 5 git commands to generate.