Refactor TmfExperiment
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / experiment / TmfExperimentLocation.java
CommitLineData
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
6c13869b 14package org.eclipse.linuxtools.tmf.core.experiment;
8c8bf09f 15
0316808c 16import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
6c13869b 17import 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.
28 *
29 * @version 1.0
30 * @author Francois Chouinard
31 *
32 * @see TmfLocationArray
8c8bf09f 33 */
0316808c 34public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> implements Cloneable {
8c8bf09f 35
0316808c
FC
36 // ------------------------------------------------------------------------
37 // Constructors
38 // ------------------------------------------------------------------------
8f50c396 39
0316808c
FC
40 /**
41 * The standard constructor
42 *
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
51 *
52 * @param location the other experiment location
53 */
54 public TmfExperimentLocation(TmfExperimentLocation location) {
55 this(location.getLocation());
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() {
67// super.clone(); // To keep FindBugs happy
68 TmfLocationArray array = (TmfLocationArray) getLocation();
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");
84 ITmfLocation<? extends Comparable<?>>[] locations = ((TmfLocationArray) getLocation()).getLocations();
85 for (ITmfLocation<?> location : locations) {
86 result.append("[" + location.toString() + "]");
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}
This page took 0.037678 seconds and 5 git commands to generate.