fcb2b2bf407427b44c153b7bb00f9df4e7d19bc2
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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
;
13 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
14 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfLocation
;
17 * The ctflocation is the nugget of information that is unique to a location in a trace.
18 * it can be copied and used to restore a position in a given trace.
20 public class CtfLocation
implements ITmfLocation
<Long
>, Cloneable
{
22 public static final Long INVALID_LOCATION
= -1L;
25 * Constructor for CtfLocation.
26 * @param location Long
28 public CtfLocation(Long location
) {
29 setLocation(location
);
33 * Constructor for CtfLocation.
34 * @param timestamp ITmfTimestamp
36 public CtfLocation(ITmfTimestamp timestamp
) {
37 setLocation(timestamp
.getValue());
40 private Long fTimestamp
;
44 * @param location Long
46 public void setLocation(Long location
) {
47 this.fTimestamp
= location
;
53 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocation()
56 public Long
getLocation() {
57 return this.fTimestamp
;
63 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#clone()
66 public CtfLocation
clone() {
67 return new CtfLocation(getLocation());
71 * @see java.lang.Object#hashCode()
74 public int hashCode() {
77 result
= (prime
* result
)
78 + ((fTimestamp
== null) ?
0 : fTimestamp
.hashCode());
83 * @see java.lang.Object#equals(java.lang.Object)
86 public boolean equals(Object obj
) {
93 if (!(obj
instanceof CtfLocation
)) {
96 CtfLocation other
= (CtfLocation
) obj
;
97 if (fTimestamp
== null) {
98 if (other
.fTimestamp
!= null) {
101 } else if (!fTimestamp
.equals(other
.fTimestamp
)) {
108 * @see java.lang.Object#toString()
111 public String
toString() {
112 if( this.getLocation().equals(CtfLocation
.INVALID_LOCATION
)) {
113 return "CtfLocation: INVALID"; //$NON-NLS-1$
115 return "CtfLocation: " + getLocation().toString(); //$NON-NLS-1$
This page took 0.034137 seconds and 5 git commands to generate.