1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 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
.timestamp
.ITmfTimestamp
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.location
.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
48 public CtfLocation(final ITmfTimestamp timestamp
) {
49 this(timestamp
.getValue(), 0);
53 * Constructor using timestamp object and index
56 * The timestamp of this location
58 * The index of this location for this timestamp
61 public CtfLocation(final ITmfTimestamp timestamp
, long index
) {
62 this(timestamp
.getValue(), index
);
66 * Constructor using a long value for the timestamp, and an index
68 * @param timestampValue
74 public CtfLocation(final long timestampValue
, final long index
) {
75 super(new CtfLocationInfo(timestampValue
, index
));
79 * Constructor using a pre-made locationInfo object
82 * The locationInfo object to use
85 public CtfLocation(CtfLocationInfo locationInfo
) {
93 * Other location to copy
96 public CtfLocation(final CtfLocation location
) {
100 // ------------------------------------------------------------------------
102 // ------------------------------------------------------------------------
108 public CtfLocationInfo
getLocationInfo() {
109 return (CtfLocationInfo
) super.getLocationInfo();
112 // ------------------------------------------------------------------------
114 // ------------------------------------------------------------------------
117 public String
toString() {
118 if( this.getLocationInfo().equals(CtfLocation
.INVALID_LOCATION
)) {
119 return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
121 return super.toString();