f8b969be46269b00f6211c216217408a01e2ae55
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
{
25 public static final Long INVALID_LOCATION
= -1L;
28 * Constructor for CtfLocation.
29 * @param location Long
31 public CtfLocation(Long location
) {
32 setLocation(location
);
36 * Constructor for CtfLocation.
37 * @param timestamp ITmfTimestamp
39 public CtfLocation(ITmfTimestamp timestamp
) {
40 setLocation(timestamp
.getValue());
43 private Long fTimestamp
;
47 * @param location Long
49 public void setLocation(Long location
) {
50 this.fTimestamp
= location
;
56 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocation()
59 public Long
getLocation() {
60 return this.fTimestamp
;
66 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#clone()
69 public CtfLocation
clone() {
70 return new CtfLocation(getLocation().longValue());
74 * @see java.lang.Object#hashCode()
77 public int hashCode() {
80 result
= (prime
* result
)
81 + ((fTimestamp
== null) ?
0 : fTimestamp
.hashCode());
86 * @see java.lang.Object#equals(java.lang.Object)
89 public boolean equals(Object obj
) {
96 if (!(obj
instanceof CtfLocation
)) {
99 CtfLocation other
= (CtfLocation
) obj
;
100 if (fTimestamp
== null) {
101 if (other
.fTimestamp
!= null) {
104 } else if (!fTimestamp
.equals(other
.fTimestamp
)) {
111 * @see java.lang.Object#toString()
114 public String
toString() {
115 if( this.getLocation().equals(CtfLocation
.INVALID_LOCATION
)) {
116 return "CtfLocation: INVALID"; //$NON-NLS-1$
118 return "CtfLocation: " + getLocation().toString(); //$NON-NLS-1$
This page took 0.033062 seconds and 5 git commands to generate.