1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are made
5 * 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
10 * Matthew Khouzam - Initial API and implementation
11 * Alexandre Montplaisir - Extends TmfLocation
12 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfLocation
;
19 * The nugget of information that is unique to a location in a CTF trace.
21 * It can be copied and used to restore a position in a given trace.
24 * @author Matthew Khouzam
26 public final class CtfLocation
extends TmfLocation
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
35 public static final CtfLocationInfo INVALID_LOCATION
= new CtfLocationInfo(-1, -1);
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
42 * Basic constructor for CtfLocation. Uses a default index of 0.
45 * The timestamp of this location
47 public CtfLocation(final ITmfTimestamp timestamp
) {
48 this(timestamp
.getValue(), 0);
52 * Constructor using timestamp object and index
55 * The timestamp of this location
57 * The index of this location for this timestamp
60 public CtfLocation(final ITmfTimestamp timestamp
, long index
) {
61 this(timestamp
.getValue(), index
);
65 * Constructor using a long value for the timestamp, and an index
67 * @param timestampValue
73 public CtfLocation(final long timestampValue
, final long index
) {
74 super(new CtfLocationInfo(timestampValue
, index
));
78 * Constructor using a pre-made locationInfo object
81 * The locationInfo object to use
84 public CtfLocation(CtfLocationInfo locationInfo
) {
92 * Other location to copy
95 public CtfLocation(final CtfLocation location
) {
99 // ------------------------------------------------------------------------
101 // ------------------------------------------------------------------------
107 public CtfLocationInfo
getLocationInfo() {
108 return (CtfLocationInfo
) super.getLocationInfo();
111 // ------------------------------------------------------------------------
113 // ------------------------------------------------------------------------
116 public String
toString() {
117 if( this.getLocationInfo().equals(CtfLocation
.INVALID_LOCATION
)) {
118 return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
120 return super.toString();