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