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;
17
import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
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 class TmfExperimentLocation extends TmfLocation<TmfLocationArray> implements Cloneable {
36
// ------------------------------------------------------------------------
38
// ------------------------------------------------------------------------
41
* The standard constructor
43
* @param locations the set of trace locations
45
public TmfExperimentLocation(TmfLocationArray locations) {
50
* The copy constructor
52
* @param location the other experiment location
54
public TmfExperimentLocation(TmfExperimentLocation location) {
55
this(location.getLocation());
58
// ------------------------------------------------------------------------
60
// ------------------------------------------------------------------------
63
* @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone()
66
public TmfExperimentLocation clone() {
67
// super.clone(); // To keep FindBugs happy
68
TmfLocationArray array = (TmfLocationArray) getLocation();
69
TmfLocationArray clones = array.clone();
70
return new TmfExperimentLocation(clones);
73
// ------------------------------------------------------------------------
75
// ------------------------------------------------------------------------
78
* @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#toString()
81
@SuppressWarnings("nls")
82
public String toString() {
83
StringBuilder result = new StringBuilder("[TmfExperimentLocation");
84
ITmfLocation<? extends Comparable<?>>[] locations = ((TmfLocationArray) getLocation()).getLocations();
85
for (ITmfLocation<?> location : locations) {
86
result.append("[" + location + "]");
89
return result.toString();
93
* @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#hashCode()
96
public int hashCode() {
97
return super.hashCode();
101
* @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#equals(java.lang.Object)
104
public boolean equals(Object obj) {
108
if (!super.equals(obj)) {
111
if (getClass() != obj.getClass()) {