Remove the generic location (replace by Comparable)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / trace / TmfExperimentLocation.java
CommitLineData
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 14package org.eclipse.linuxtools.internal.tmf.core.trace;
8c8bf09f 15
5cc97265 16import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
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.
9b749023 27 *
0316808c
FC
28 * @version 1.0
29 * @author Francois Chouinard
9b749023 30 *
0316808c 31 * @see TmfLocationArray
8c8bf09f 32 */
1e1bef82 33public class TmfExperimentLocation implements ITmfLocation {
cb8c854e
FC
34
35 TmfLocationArray fLocation;
8c8bf09f 36
0316808c
FC
37 // ------------------------------------------------------------------------
38 // Constructors
39 // ------------------------------------------------------------------------
8f50c396 40
0316808c
FC
41 /**
42 * The standard constructor
9b749023 43 *
0316808c
FC
44 * @param locations the set of trace locations
45 */
46 public TmfExperimentLocation(TmfLocationArray locations) {
cb8c854e 47 fLocation = locations;
0316808c 48 }
8c8bf09f 49
0316808c
FC
50 /**
51 * The copy constructor
9b749023 52 *
0316808c
FC
53 * @param location the other experiment location
54 */
55 public TmfExperimentLocation(TmfExperimentLocation location) {
6bab4511 56 this(location.getLocationData());
0316808c 57 }
8c8bf09f 58
0316808c
FC
59 // ------------------------------------------------------------------------
60 // Cloneable
61 // ------------------------------------------------------------------------
9b635e61 62
0316808c
FC
63 /* (non-Javadoc)
64 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone()
65 */
66 @Override
67 public TmfExperimentLocation clone() {
5cc97265 68// super.clone(); // To keep FindBugs happy
6bab4511 69 TmfLocationArray array = getLocationData();
0316808c
FC
70 TmfLocationArray clones = array.clone();
71 return new TmfExperimentLocation(clones);
8f50c396 72 }
6e85c58d 73
0316808c
FC
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");
1e1bef82
FC
85 ITmfLocation[] locations = getLocationData().getLocations();
86 for (ITmfLocation location : locations) {
3bd44ac8 87 result.append("[" + location + "]");
0316808c
FC
88 }
89 result.append("]");
90 return result.toString();
91 }
92
93 /* (non-Javadoc)
94 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#hashCode()
95 */
6e85c58d
FC
96 @Override
97 public int hashCode() {
0316808c 98 return super.hashCode();
6e85c58d
FC
99 }
100
0316808c
FC
101 /* (non-Javadoc)
102 * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#equals(java.lang.Object)
103 */
6e85c58d
FC
104 @Override
105 public boolean equals(Object obj) {
0316808c 106 if (this == obj) {
6e85c58d 107 return true;
0316808c
FC
108 }
109 if (!super.equals(obj)) {
6e85c58d 110 return false;
0316808c
FC
111 }
112 if (getClass() != obj.getClass()) {
6e85c58d 113 return false;
0316808c 114 }
6e85c58d
FC
115 return true;
116 }
117
cb8c854e
FC
118 /* (non-Javadoc)
119 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocationData()
120 */
121 @Override
122 public TmfLocationArray getLocationData() {
123 return fLocation;
124 }
125
8c8bf09f 126}
This page took 0.050432 seconds and 5 git commands to generate.