lttng: Add a diagram showing the dependencies between plugins
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.core / src / org / eclipse / linuxtools / internal / lttng2 / core / control / model / impl / TraceInfo.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
13
14 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ITraceInfo;
15
16 /**
17 * <p>
18 * Implementation of the base trace information interface (ITraceInfo) to
19 * store common data.
20 * </p>
21 *
22 * @author Bernd Hufmann
23 */
24 public 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();
55 }
56 fName = String.valueOf(other.fName);
57 }
58
59 // ------------------------------------------------------------------------
60 // Accessors
61 // ------------------------------------------------------------------------
62
63 @Override
64 public String getName() {
65 return fName;
66 }
67
68 @Override
69 public void setName(String name) {
70 fName = name;
71 }
72
73 @Override
74 public int hashCode() {
75 final int prime = 31;
76 int result = 1;
77 result = prime * result + ((fName == null) ? 0 : fName.hashCode());
78 return result;
79 }
80
81 @Override
82 public boolean equals(Object obj) {
83 if (this == obj) {
84 return true;
85 }
86 if (obj == null) {
87 return false;
88 }
89 if (getClass() != obj.getClass()) {
90 return false;
91 }
92 TraceInfo other = (TraceInfo) obj;
93 if (fName == null) {
94 if (other.fName != null) {
95 return false;
96 }
97 } else if (!fName.equals(other.fName)) {
98 return false;
99 }
100 return true;
101 }
102
103 @SuppressWarnings("nls")
104 @Override
105 public String toString() {
106 StringBuffer output = new StringBuffer();
107 output.append("[TraceInfo(");
108 output.append("Name=");
109 output.append(getName());
110 output.append(")]");
111 return output.toString();
112 }
113 }
This page took 0.032383 seconds and 5 git commands to generate.