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 public class TmfLocation
<L
> implements ITmfLocation
<L
> {
26 @SuppressWarnings("unused")
27 private TmfLocation() {
30 public TmfLocation(L location
) {
34 public TmfLocation(TmfLocation
<L
> other
) {
36 throw new IllegalArgumentException();
37 fLocation
= other
.fLocation
;
40 public void setLocation(L location
) {
44 public L
getLocation() {
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 public int hashCode() {
54 return fLocation
.hashCode();
58 public boolean equals(Object other
) {
59 if (!(other
instanceof TmfLocation
<?
>))
61 TmfLocation
<?
> o
= (TmfLocation
<?
>) other
;
62 return fLocation
.equals(o
.fLocation
);
66 public String
toString() {
67 return fLocation
.toString();
70 @SuppressWarnings("unchecked")
72 public TmfLocation
<L
> clone() {
73 TmfLocation
<L
> clone
= null;
75 clone
= (TmfLocation
<L
>) super.clone();
76 Class
<?
> clazz
= this.fLocation
.getClass();
77 Method method
= clazz
.getMethod("clone", new Class
[0]);
78 Object duplic
= method
.invoke(this.fLocation
, new Object
[0]);
79 clone
.fLocation
= (L
) duplic
;
80 } catch (NoSuchMethodException e
) {
81 // exception suppressed
82 } catch (Exception e
) {
83 throw new InternalError(e
.toString());
This page took 0.036876 seconds and 5 git commands to generate.