1 /*******************************************************************************
2 * Copyright (c) 2009, 2010, 2012 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.internal
.tmf
.core
.trace
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfLocation
;
20 * The experiment location in TMF.
22 * An experiment location is actually the set of locations of the traces it
23 * contains. By setting the individual traces to their corresponding locations,
24 * the experiment can be positioned to read the next chronological event.
26 * It is the responsibility of the user the individual trace locations are valid
27 * and that they are matched to the correct trace.
30 * @author Francois Chouinard
32 * @see TmfLocationArray
34 public final class TmfExperimentLocation
implements ITmfLocation
{
36 private final TmfLocationArray fLocation
;
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
43 * The standard constructor
45 * @param locations the set of trace locations
47 public TmfExperimentLocation(TmfLocationArray locations
) {
48 fLocation
= locations
;
52 * The copy constructor
54 * @param location the other experiment location
56 public TmfExperimentLocation(TmfExperimentLocation location
) {
57 this(location
.getLocationInfo());
61 * The "update" constructor. Copies the array of locations and updates
64 * @param exp_location the experiment location
65 * @param index the entry to modify
66 * @param location the new entry
68 public TmfExperimentLocation(TmfExperimentLocation exp_location
, int index
, ITmfLocation location
) {
69 fLocation
= new TmfLocationArray(exp_location
.fLocation
, index
, location
);
72 // ------------------------------------------------------------------------
74 // ------------------------------------------------------------------------
77 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#toString()
80 @SuppressWarnings("nls")
81 public String
toString() {
82 StringBuilder result
= new StringBuilder("[TmfExperimentLocation");
84 ITmfLocation location
= getLocationInfo().getLocation(index
);
85 while (location
!= null) {
86 result
.append("[" + location
+ "]");
87 location
= getLocationInfo().getLocation(++index
);
90 return result
.toString();
94 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#hashCode()
97 public int hashCode() {
98 return super.hashCode();
102 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#equals(java.lang.Object)
105 public boolean equals(Object obj
) {
109 if (!super.equals(obj
)) {
112 if (getClass() != obj
.getClass()) {
119 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocationData()
122 public TmfLocationArray
getLocationInfo() {