1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 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
10 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.core
.event
.lookup
;
15 import java
.util
.Objects
;
17 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 import org
.eclipse
.jdt
.annotation
.Nullable
;
21 * TMF call site information for source code lookup.
23 * @author Bernd Hufmann
25 public class TmfCallsite
implements ITmfCallsite
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 /** The file name string. */
32 private final @NonNull String fFileName
;
34 /** The line number. */
35 private final @Nullable Long fLineNumber
;
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
45 * The source file's name
47 * The line number in the source file
50 public TmfCallsite(@NonNull String fileName
, @Nullable Long lineNumber
) {
52 fLineNumber
= lineNumber
;
59 * - An other call site implementation
61 public TmfCallsite(@NonNull ITmfCallsite other
) {
62 fFileName
= other
.getFileName();
63 fLineNumber
= other
.getLineNo();
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
71 public @NonNull String
getFileName() {
79 public @Nullable Long
getLineNo() {
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
88 public int hashCode() {
89 return Objects
.hash(fFileName
, fLineNumber
);
93 public boolean equals(Object obj
) {
100 if (getClass() != obj
.getClass()) {
103 TmfCallsite other
= (TmfCallsite
) obj
;
105 // fFileName cannot be null!
106 if (!fFileName
.equals(other
.fFileName
)) {
110 if (fLineNumber
!= other
.fLineNumber
) {
117 public String
toString() {
118 Long lineNumber
= fLineNumber
;
120 StringBuilder builder
= new StringBuilder();
121 builder
.append(fFileName
).append(':');
122 builder
.append(lineNumber
== null ?
"??" : Long
.toString(lineNumber
)); //$NON-NLS-1$
123 return builder
.toString();
This page took 0.032965 seconds and 5 git commands to generate.