bbd7b650dfdcfbaf2624ac6461057f140538833f
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / trace / TmfExperimentLocation.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 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 * Patrick Tasse - Updated for ranks in experiment location
13 *******************************************************************************/
14
15 package org.eclipse.linuxtools.internal.tmf.core.trace;
16
17 import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
18
19
20 /**
21 * The experiment location in TMF.
22 * <p>
23 * An experiment location is actually the set of locations of the traces it
24 * contains. By setting the individual traces to their corresponding locations,
25 * the experiment can be positioned to read the next chronological event.
26 * <p>
27 * It is the responsibility of the user the individual trace locations are valid
28 * and that they are matched to the correct trace.
29 *
30 * @version 1.0
31 * @author Francois Chouinard
32 *
33 * @see TmfLocationArray
34 */
35 public final class TmfExperimentLocation implements ITmfLocation {
36
37 private final TmfLocationArray fLocation;
38
39 // ------------------------------------------------------------------------
40 // Constructors
41 // ------------------------------------------------------------------------
42
43 /**
44 * The standard constructor
45 *
46 * @param locations the set of trace locations
47 */
48 public TmfExperimentLocation(TmfLocationArray locations) {
49 fLocation = locations;
50 }
51
52 /**
53 * The copy constructor
54 *
55 * @param location the other experiment location
56 */
57 public TmfExperimentLocation(TmfExperimentLocation location) {
58 this(location.getLocationInfo());
59 }
60
61 // ------------------------------------------------------------------------
62 // Object
63 // ------------------------------------------------------------------------
64
65 @Override
66 @SuppressWarnings("nls")
67 public String toString() {
68 StringBuilder result = new StringBuilder("TmfExperimentLocation [");
69 result.append(fLocation.toString());
70 result.append("]");
71 return result.toString();
72 }
73
74 @Override
75 public int hashCode() {
76 final int prime = 31;
77 int result = 1;
78 result = prime * result + ((fLocation != null) ? fLocation.hashCode() : 0);
79 return result;
80 }
81
82 @Override
83 public boolean equals(Object obj) {
84 if (this == obj) {
85 return true;
86 }
87 if (obj == null) {
88 return false;
89 }
90 if (getClass() != obj.getClass()) {
91 return false;
92 }
93 final TmfExperimentLocation other = (TmfExperimentLocation) obj;
94 if (fLocation == null) {
95 if (other.fLocation != null) {
96 return false;
97 }
98 } else if (!fLocation.equals(other.fLocation)) {
99 return false;
100 }
101 return true;
102 }
103
104 @Override
105 public TmfLocationArray getLocationInfo() {
106 return fLocation;
107 }
108
109 }
This page took 0.032455 seconds and 5 git commands to generate.