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 | ||
13 | package org.eclipse.linuxtools.tmf.experiment; | |
14 | ||
452ad365 | 15 | import org.eclipse.linuxtools.tmf.trace.TmfLocation; |
8c8bf09f ASL |
16 | |
17 | /** | |
18 | * <b><u>TmfExperimentLocation</u></b> | |
19 | * <p> | |
20 | * The experiment location is the set of its traces' locations. | |
21 | */ | |
a79913eb | 22 | public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> { |
8c8bf09f | 23 | |
8f50c396 FC |
24 | private long[] fRanks; |
25 | ||
a79913eb | 26 | public TmfExperimentLocation(TmfLocationArray locations, long[] ranks) { |
452ad365 | 27 | super(locations); |
8f50c396 | 28 | fRanks = ranks; |
8c8bf09f ASL |
29 | } |
30 | ||
17c0074a | 31 | @Override |
8c8bf09f | 32 | public TmfExperimentLocation clone() { |
2fb2eb37 | 33 | super.clone(); // To keep FindBugs happy |
a79913eb FC |
34 | TmfLocationArray array = (TmfLocationArray) getLocation(); |
35 | TmfLocationArray clones = array.clone(); | |
8f50c396 | 36 | return new TmfExperimentLocation(clones, fRanks.clone()); |
8c8bf09f ASL |
37 | } |
38 | ||
9b635e61 | 39 | @Override |
3b38ea61 | 40 | @SuppressWarnings("nls") |
9b635e61 FC |
41 | public String toString() { |
42 | StringBuilder result = new StringBuilder("[TmfExperimentLocation"); | |
a79913eb FC |
43 | TmfLocationArray array = (TmfLocationArray) getLocation(); |
44 | for (int i = 0; i < array.locations.length; i++) { | |
45 | result.append("[" + array.locations[i].toString() + "," + fRanks[i] + "]"); | |
9b635e61 FC |
46 | } |
47 | result.append("]"); | |
48 | return result.toString(); | |
49 | } | |
50 | ||
8f50c396 FC |
51 | public long[] getRanks() { |
52 | return fRanks; | |
53 | } | |
8c8bf09f | 54 | } |