lttng: Fix Javadoc in lttng2.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.core / src / org / eclipse / linuxtools / internal / lttng2 / core / control / model / impl / TraceInfo.java
CommitLineData
eb1bab5b
BH
1/**********************************************************************
2 * Copyright (c) 2012 Ericsson
b0318660 3 *
eb1bab5b
BH
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
b0318660
AM
8 *
9 * Contributors:
eb1bab5b
BH
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
9315aeee 12package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
eb1bab5b 13
9315aeee 14import org.eclipse.linuxtools.internal.lttng2.core.control.model.ITraceInfo;
eb1bab5b
BH
15
16/**
eb1bab5b
BH
17 * <p>
18 * Implementation of the base trace information interface (ITraceInfo) to
19 * store common data.
20 * </p>
b0318660 21 *
dbd4432d 22 * @author Bernd Hufmann
eb1bab5b
BH
23 */
24public class TraceInfo implements ITraceInfo {
25
26 // ------------------------------------------------------------------------
27 // Attributes
28 // ------------------------------------------------------------------------
29 /**
30 * The name of the element.
31 */
32 private String fName = null;
33
34 // ------------------------------------------------------------------------
35 // Constructors
36 // ------------------------------------------------------------------------
37 /**
38 * Constructor
39 * @param name - name of trace element
40 */
41 public TraceInfo(String name) {
42 if (name == null) {
43 throw new IllegalArgumentException();
44 }
45 fName = name;
46 }
47
48 /**
49 * Copy constructor
50 * @param other - the instance to copy
51 */
52 public TraceInfo(TraceInfo other) {
53 if (other == null) {
54 throw new IllegalArgumentException();
eb1bab5b 55 }
b0318660 56 fName = String.valueOf(other.fName);
eb1bab5b
BH
57 }
58
59 // ------------------------------------------------------------------------
60 // Accessors
61 // ------------------------------------------------------------------------
62 /*
63 * (non-Javadoc)
115b4a01 64 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#getName()
eb1bab5b
BH
65 */
66 @Override
67 public String getName() {
68 return fName;
69 }
70
71 /*
72 * (non-Javadoc)
115b4a01 73 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#setName(java.lang.String)
eb1bab5b
BH
74 */
75 @Override
76 public void setName(String name) {
77 fName = name;
78 }
b0318660 79
eb1bab5b
BH
80 /*
81 * (non-Javadoc)
82 * @see java.lang.Object#hashCode()
83 */
84 @Override
85 public int hashCode() {
d132bcc7
BH
86 final int prime = 31;
87 int result = 1;
88 result = prime * result + ((fName == null) ? 0 : fName.hashCode());
89 return result;
eb1bab5b
BH
90 }
91
92 /*
93 * (non-Javadoc)
94 * @see java.lang.Object#equals(java.lang.Object)
95 */
96 @Override
d132bcc7
BH
97 public boolean equals(Object obj) {
98 if (this == obj) {
99 return true;
100 }
101 if (obj == null) {
eb1bab5b
BH
102 return false;
103 }
d132bcc7
BH
104 if (getClass() != obj.getClass()) {
105 return false;
106 }
107 TraceInfo other = (TraceInfo) obj;
108 if (fName == null) {
109 if (other.fName != null) {
110 return false;
111 }
112 } else if (!fName.equals(other.fName)) {
113 return false;
114 }
115 return true;
b0318660 116 }
eb1bab5b
BH
117 /*
118 * (non-Javadoc)
119 * @see java.lang.Object#toString()
120 */
121 @SuppressWarnings("nls")
122 @Override
123 public String toString() {
124 StringBuffer output = new StringBuffer();
125 output.append("[TraceInfo(");
126 output.append("Name=");
127 output.append(getName());
128 output.append(")]");
129 return output.toString();
130 }
131}
This page took 0.033629 seconds and 5 git commands to generate.