Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
0316808c | 2 | * Copyright (c) 2009, 2010, 2012 Ericsson |
9b749023 | 3 | * |
8c8bf09f ASL |
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 | |
9b749023 | 8 | * |
8c8bf09f | 9 | * Contributors: |
0316808c FC |
10 | * Francois Chouinard - Initial API and implementation |
11 | * Francois Chouinard - Updated as per TMF Trace Model 1.0 | |
8c8bf09f ASL |
12 | *******************************************************************************/ |
13 | ||
9e0640dc | 14 | package org.eclipse.linuxtools.internal.tmf.core.trace; |
8c8bf09f | 15 | |
5cc97265 | 16 | import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation; |
6c13869b | 17 | import org.eclipse.linuxtools.tmf.core.trace.TmfLocation; |
8c8bf09f ASL |
18 | |
19 | /** | |
0316808c FC |
20 | * The experiment location in TMF. |
21 | * <p> | |
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. | |
8c8bf09f | 25 | * <p> |
0316808c FC |
26 | * It is the responsibility of the user the individual trace locations are valid |
27 | * and that they are matched to the correct trace. | |
9b749023 | 28 | * |
0316808c FC |
29 | * @version 1.0 |
30 | * @author Francois Chouinard | |
9b749023 | 31 | * |
0316808c | 32 | * @see TmfLocationArray |
8c8bf09f | 33 | */ |
9b749023 | 34 | public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> { |
8c8bf09f | 35 | |
0316808c FC |
36 | // ------------------------------------------------------------------------ |
37 | // Constructors | |
38 | // ------------------------------------------------------------------------ | |
8f50c396 | 39 | |
0316808c FC |
40 | /** |
41 | * The standard constructor | |
9b749023 | 42 | * |
0316808c FC |
43 | * @param locations the set of trace locations |
44 | */ | |
45 | public TmfExperimentLocation(TmfLocationArray locations) { | |
46 | super(locations); | |
47 | } | |
8c8bf09f | 48 | |
0316808c FC |
49 | /** |
50 | * The copy constructor | |
9b749023 | 51 | * |
0316808c FC |
52 | * @param location the other experiment location |
53 | */ | |
54 | public TmfExperimentLocation(TmfExperimentLocation location) { | |
6bab4511 | 55 | this(location.getLocationData()); |
0316808c | 56 | } |
8c8bf09f | 57 | |
0316808c FC |
58 | // ------------------------------------------------------------------------ |
59 | // Cloneable | |
60 | // ------------------------------------------------------------------------ | |
9b635e61 | 61 | |
0316808c FC |
62 | /* (non-Javadoc) |
63 | * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone() | |
64 | */ | |
65 | @Override | |
66 | public TmfExperimentLocation clone() { | |
5cc97265 | 67 | // super.clone(); // To keep FindBugs happy |
6bab4511 | 68 | TmfLocationArray array = getLocationData(); |
0316808c FC |
69 | TmfLocationArray clones = array.clone(); |
70 | return new TmfExperimentLocation(clones); | |
8f50c396 | 71 | } |
6e85c58d | 72 | |
0316808c FC |
73 | // ------------------------------------------------------------------------ |
74 | // Object | |
75 | // ------------------------------------------------------------------------ | |
76 | ||
77 | /* (non-Javadoc) | |
78 | * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#toString() | |
79 | */ | |
80 | @Override | |
81 | @SuppressWarnings("nls") | |
82 | public String toString() { | |
83 | StringBuilder result = new StringBuilder("[TmfExperimentLocation"); | |
6bab4511 | 84 | ITmfLocation<? extends Comparable<?>>[] locations = getLocationData().getLocations(); |
5cc97265 | 85 | for (ITmfLocation<?> location : locations) { |
3bd44ac8 | 86 | result.append("[" + location + "]"); |
0316808c FC |
87 | } |
88 | result.append("]"); | |
89 | return result.toString(); | |
90 | } | |
91 | ||
92 | /* (non-Javadoc) | |
93 | * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#hashCode() | |
94 | */ | |
6e85c58d FC |
95 | @Override |
96 | public int hashCode() { | |
0316808c | 97 | return super.hashCode(); |
6e85c58d FC |
98 | } |
99 | ||
0316808c FC |
100 | /* (non-Javadoc) |
101 | * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#equals(java.lang.Object) | |
102 | */ | |
6e85c58d FC |
103 | @Override |
104 | public boolean equals(Object obj) { | |
0316808c | 105 | if (this == obj) { |
6e85c58d | 106 | return true; |
0316808c FC |
107 | } |
108 | if (!super.equals(obj)) { | |
6e85c58d | 109 | return false; |
0316808c FC |
110 | } |
111 | if (getClass() != obj.getClass()) { | |
6e85c58d | 112 | return false; |
0316808c | 113 | } |
6e85c58d FC |
114 | return true; |
115 | } | |
116 | ||
8c8bf09f | 117 | } |