Merge branch 'master' into lttng-kepler
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / trace / TmfExperimentLocation.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010, 2012 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 * Francois Chouinard - Updated as per TMF Trace Model 1.0
12 *******************************************************************************/
13
14 package org.eclipse.linuxtools.internal.tmf.core.trace;
15
16 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
17
18 /**
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.
24 * <p>
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
32 */
33 public class TmfExperimentLocation implements ITmfLocation {
34
35 TmfLocationArray fLocation;
36
37 // ------------------------------------------------------------------------
38 // Constructors
39 // ------------------------------------------------------------------------
40
41 /**
42 * The standard constructor
43 *
44 * @param locations the set of trace locations
45 */
46 public TmfExperimentLocation(TmfLocationArray locations) {
47 fLocation = locations;
48 }
49
50 /**
51 * The copy constructor
52 *
53 * @param location the other experiment location
54 */
55 public TmfExperimentLocation(TmfExperimentLocation location) {
56 this(location.getLocationInfo());
57 }
58
59 // ------------------------------------------------------------------------
60 // Cloneable
61 // ------------------------------------------------------------------------
62
63 /* (non-Javadoc)
64 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone()
65 */
66 @Override
67 public TmfExperimentLocation clone() {
68 // super.clone(); // To keep FindBugs happy
69 TmfLocationArray array = getLocationInfo();
70 TmfLocationArray clones = array.clone();
71 return new TmfExperimentLocation(clones);
72 }
73
74 // ------------------------------------------------------------------------
75 // Object
76 // ------------------------------------------------------------------------
77
78 /* (non-Javadoc)
79 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#toString()
80 */
81 @Override
82 @SuppressWarnings("nls")
83 public String toString() {
84 StringBuilder result = new StringBuilder("[TmfExperimentLocation");
85 ITmfLocation[] locations = getLocationInfo().getLocations();
86 for (ITmfLocation location : locations) {
87 result.append("[" + location + "]");
88 }
89 result.append("]");
90 return result.toString();
91 }
92
93 /* (non-Javadoc)
94 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#hashCode()
95 */
96 @Override
97 public int hashCode() {
98 return super.hashCode();
99 }
100
101 /* (non-Javadoc)
102 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#equals(java.lang.Object)
103 */
104 @Override
105 public boolean equals(Object obj) {
106 if (this == obj) {
107 return true;
108 }
109 if (!super.equals(obj)) {
110 return false;
111 }
112 if (getClass() != obj.getClass()) {
113 return false;
114 }
115 return true;
116 }
117
118 /* (non-Javadoc)
119 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocationData()
120 */
121 @Override
122 public TmfLocationArray getLocationInfo() {
123 return fLocation;
124 }
125
126 }
This page took 0.033322 seconds and 6 git commands to generate.