requirements: Implement all level for event names and fields
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / trace / location / TmfLocation.java
CommitLineData
8c8bf09f 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2009, 2014 Ericsson
0283f7ff 3 *
8c8bf09f
ASL
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
0283f7ff 8 *
8c8bf09f
ASL
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
fcccd900 11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
8c8bf09f
ASL
12 *******************************************************************************/
13
2bdf0193 14package org.eclipse.tracecompass.tmf.core.trace.location;
8c8bf09f 15
577ee847 16
8c8bf09f 17/**
5976d44a
FC
18 * A abstract implementation of ITmfLocation. The concrete classes must provide
19 * comparable location information.
0283f7ff 20 *
f7703ed6 21 * @author Francois Chouinard
8c8bf09f 22 */
d62bb185 23public abstract class TmfLocation implements ITmfLocation {
fcccd900 24
fcccd900
FC
25 // ------------------------------------------------------------------------
26 // Attributes
27 // ------------------------------------------------------------------------
28
d62bb185 29 private final Comparable<?> fLocationInfo;
fcccd900
FC
30
31 // ------------------------------------------------------------------------
32 // Constructors
33 // ------------------------------------------------------------------------
34
fcccd900
FC
35 /**
36 * Standard constructor.
0283f7ff 37 *
a749efcb
AM
38 * @param locationInfo
39 * The concrete trace location
fcccd900 40 */
5976d44a
FC
41 public TmfLocation(final Comparable<?> locationInfo) {
42 fLocationInfo = locationInfo;
fcccd900
FC
43 }
44
45 /**
46 * Copy constructor
0283f7ff 47 *
a749efcb
AM
48 * @param location
49 * The original trace location
fcccd900 50 */
1e1bef82 51 public TmfLocation(final TmfLocation location) {
5976d44a 52 fLocationInfo = location.fLocationInfo;
fcccd900
FC
53 }
54
55 // ------------------------------------------------------------------------
56 // Getters
57 // ------------------------------------------------------------------------
58
fcccd900 59 @Override
5976d44a
FC
60 public Comparable<?> getLocationInfo() {
61 return fLocationInfo;
fcccd900
FC
62 }
63
fcccd900 64 // ------------------------------------------------------------------------
ff4ed569
FC
65 // Object
66 // ------------------------------------------------------------------------
67
fcccd900 68 @Override
ff4ed569 69 public int hashCode() {
fcccd900
FC
70 final int prime = 31;
71 int result = 1;
5976d44a 72 result = prime * result + ((fLocationInfo != null) ? fLocationInfo.hashCode() : 0);
fcccd900 73 return result;
ff4ed569
FC
74 }
75
76 @Override
5d837f9b 77 public boolean equals(final Object obj) {
0316808c 78 if (this == obj) {
fcccd900 79 return true;
0316808c
FC
80 }
81 if (obj == null) {
fcccd900 82 return false;
0316808c
FC
83 }
84 if (getClass() != obj.getClass()) {
fcccd900 85 return false;
0316808c 86 }
1e1bef82 87 final TmfLocation other = (TmfLocation) obj;
5976d44a
FC
88 if (fLocationInfo == null) {
89 if (other.fLocationInfo != null) {
fcccd900 90 return false;
0316808c 91 }
5976d44a 92 } else if (!fLocationInfo.equals(other.fLocationInfo)) {
fcccd900 93 return false;
0316808c 94 }
fcccd900 95 return true;
ff4ed569
FC
96 }
97
fcccd900 98 @Override
cbdacf03 99 @SuppressWarnings("nls")
fcccd900 100 public String toString() {
980a93c6 101 return getClass().getSimpleName() + " [fLocationInfo=" + fLocationInfo + "]";
fcccd900 102 }
452ad365 103
8c8bf09f 104}
This page took 0.098666 seconds and 5 git commands to generate.