1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.trace
;
15 import java
.lang
.reflect
.Method
;
18 * <b><u>TmfLocation</u></b>
20 * A generic implementation of ITmfLocation
22 @SuppressWarnings("rawtypes")
23 public class TmfLocation
<L
extends Comparable
> implements ITmfLocation
<L
> {
27 @SuppressWarnings("unused")
28 private TmfLocation() {
31 public TmfLocation(L location
) {
35 public TmfLocation(TmfLocation
<L
> other
) {
37 throw new IllegalArgumentException();
38 fLocation
= other
.fLocation
;
42 public void setLocation(L location
) {
47 public L
getLocation() {
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
56 public int hashCode() {
57 if (fLocation
== null)
59 return fLocation
.hashCode();
63 public boolean equals(Object other
) {
64 if (!(other
instanceof TmfLocation
<?
>))
66 TmfLocation
<?
> o
= (TmfLocation
<?
>) other
;
67 if (fLocation
== null)
68 return (o
.fLocation
== null);
69 return fLocation
.equals(o
.fLocation
);
73 @SuppressWarnings("nls")
74 public String
toString() {
75 if (fLocation
== null)
77 return fLocation
.toString();
81 @SuppressWarnings({ "nls", "unchecked" })
82 public TmfLocation
<L
> clone() {
83 TmfLocation
<L
> clone
= null;
85 clone
= (TmfLocation
<L
>) super.clone();
86 if (this.fLocation
!= null) {
87 Class
<?
> clazz
= this.fLocation
.getClass();
88 Method method
= clazz
.getMethod("clone", new Class
[0]);
89 Object duplic
= method
.invoke(this.fLocation
, new Object
[0]);
90 clone
.fLocation
= (L
) duplic
;
92 } catch (NoSuchMethodException e
) {
93 // exception suppressed
94 } catch (Exception e
) {
95 throw new InternalError(e
.toString());
This page took 0.031746 seconds and 5 git commands to generate.