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