~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfExperimentLocation.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
 
18
 
 
19
/**
 
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.
 
25
 * <p>
 
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
 
33
 */
 
34
public class TmfExperimentLocation extends TmfLocation<TmfLocationArray> implements Cloneable {
 
35
 
 
36
    // ------------------------------------------------------------------------
 
37
    // Constructors
 
38
    // ------------------------------------------------------------------------
 
39
 
 
40
    /**
 
41
     * The standard constructor
 
42
     * 
 
43
     * @param locations the set of trace locations
 
44
     */
 
45
    public TmfExperimentLocation(TmfLocationArray locations) {
 
46
        super(locations);
 
47
    }
 
48
 
 
49
    /**
 
50
     * The copy constructor
 
51
     * 
 
52
     * @param location the other experiment location
 
53
     */
 
54
    public TmfExperimentLocation(TmfExperimentLocation location) {
 
55
        this(location.getLocation());
 
56
    }
 
57
 
 
58
    // ------------------------------------------------------------------------
 
59
    // Cloneable
 
60
    // ------------------------------------------------------------------------
 
61
 
 
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);
 
71
    }
 
72
 
 
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 + "]");
 
87
        }
 
88
        result.append("]");
 
89
        return result.toString();
 
90
    }
 
91
 
 
92
    /* (non-Javadoc)
 
93
     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#hashCode()
 
94
     */
 
95
    @Override
 
96
    public int hashCode() {
 
97
        return super.hashCode();
 
98
    }
 
99
 
 
100
    /* (non-Javadoc)
 
101
     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#equals(java.lang.Object)
 
102
     */
 
103
    @Override
 
104
    public boolean equals(Object obj) {
 
105
        if (this == obj) {
 
106
            return true;
 
107
        }
 
108
        if (!super.equals(obj)) {
 
109
            return false;
 
110
        }
 
111
        if (getClass() != obj.getClass()) {
 
112
            return false;
 
113
        }
 
114
        return true;
 
115
    }
 
116
 
 
117
}