1 /*******************************************************************************
2 * Copyright (c) 2009, 2010, 2012 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.core
.trace
;
17 * A convenience implementation on of ITmfLocation. The generic class (L) must
21 * @author Francois Chouinard
23 public abstract class TmfLocation
implements ITmfLocation
, Cloneable
{
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
29 private Comparable
<?
> fLocationData
;
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
36 * Default constructor (for the 'null' location)
38 @SuppressWarnings("unused")
39 private TmfLocation() {
43 * Standard constructor.
45 * @param locationData the trace location
47 public TmfLocation(final Comparable
<?
> locationData
) {
48 fLocationData
= locationData
;
54 * @param location the original location
56 public TmfLocation(final TmfLocation location
) {
57 fLocationData
= location
.fLocationData
;
60 // ------------------------------------------------------------------------
62 // ------------------------------------------------------------------------
68 public Comparable
<?
> getLocationData() {
72 // ------------------------------------------------------------------------
74 // ------------------------------------------------------------------------
77 public abstract TmfLocation
clone();
80 // * @see java.lang.Object#clone()
83 // @SuppressWarnings("unchecked")
84 // public TmfLocation<L> clone() {
85 // TmfLocation<L> clone = null;
87 // clone = (TmfLocation<L>) super.clone();
88 // if (fLocationData != null) {
89 // final Class<?> clazz = fLocationData.getClass();
90 // final Method method = clazz.getMethod("clone", new Class[0]); //$NON-NLS-1$
91 // final Object copy = method.invoke(this.fLocationData, new Object[0]);
92 // clone.fLocationData = (L) copy;
94 // clone.fLocationData = null;
96 // } catch (final CloneNotSupportedException e) {
97 // } catch (final NoSuchMethodException e) {
98 // } catch (final Exception e) {
99 // throw new InternalError(e.toString());
104 // ------------------------------------------------------------------------
106 // ------------------------------------------------------------------------
109 * @see java.lang.Object#hashCode()
112 public int hashCode() {
113 final int prime
= 31;
115 result
= prime
* result
+ ((fLocationData
!= null) ? fLocationData
.hashCode() : 0);
120 * @see java.lang.Object#equals(java.lang.Object)
123 public boolean equals(final Object obj
) {
130 if (getClass() != obj
.getClass()) {
133 final TmfLocation other
= (TmfLocation
) obj
;
134 if (fLocationData
== null) {
135 if (other
.fLocationData
!= null) {
138 } else if (!fLocationData
.equals(other
.fLocationData
)) {
145 @SuppressWarnings("nls")
146 public String
toString() {
147 return "TmfLocation [fLocation=" + fLocationData
+ "]";
This page took 0.034508 seconds and 5 git commands to generate.