1 /**********************************************************************
2 * Copyright (c) 2012, 2013 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 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
;
14 import java
.util
.ArrayList
;
15 import java
.util
.Iterator
;
16 import java
.util
.List
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IBaseEventInfo
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IUstProviderInfo
;
23 * Implementation of the Ust Provider interface (IUstProviderInfo) to store UST
24 * provider related data.
27 * @author Bernd Hufmann
29 public class UstProviderInfo
extends TraceInfo
implements IUstProviderInfo
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 * The process ID of the UST provider.
39 * List of event information.
41 private final List
<IBaseEventInfo
> fEvents
= new ArrayList
<IBaseEventInfo
>();
43 // ------------------------------------------------------------------------
45 // ------------------------------------------------------------------------
48 * @param name - name of UST provider
50 public UstProviderInfo(String name
) {
56 * @param other - the instance to copy
58 public UstProviderInfo(UstProviderInfo other
) {
61 for (Iterator
<IBaseEventInfo
> iterator
= other
.fEvents
.iterator(); iterator
.hasNext();) {
62 IBaseEventInfo event
= iterator
.next();
63 if (event
instanceof BaseEventInfo
) {
64 fEvents
.add(new BaseEventInfo((BaseEventInfo
)event
));
71 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
77 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#getPid()
86 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#setPid(int)
89 public void setPid(int pid
) {
95 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#getEvents()
98 public IBaseEventInfo
[] getEvents() {
99 return fEvents
.toArray(new IBaseEventInfo
[fEvents
.size()]);
104 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#setEvents(java.util.List)
107 public void setEvents(List
<IBaseEventInfo
> events
) {
109 for (Iterator
<IBaseEventInfo
> iterator
= events
.iterator(); iterator
.hasNext();) {
110 IBaseEventInfo eventInfo
= iterator
.next();
111 fEvents
.add(eventInfo
);
117 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#addEvent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IBaseEventInfo)
120 public void addEvent(IBaseEventInfo event
) {
124 // ------------------------------------------------------------------------
126 // ------------------------------------------------------------------------
130 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
133 public int hashCode() {
134 final int prime
= 31;
135 int result
= super.hashCode();
136 result
= prime
* result
+ fEvents
.hashCode();
137 result
= prime
* result
+ fPid
;
143 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
146 public boolean equals(Object obj
) {
150 if (!super.equals(obj
)) {
153 if (getClass() != obj
.getClass()) {
156 UstProviderInfo other
= (UstProviderInfo
) obj
;
157 if (!fEvents
.equals(other
.fEvents
)) {
160 if (fPid
!= other
.fPid
) {
168 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
170 @SuppressWarnings("nls")
172 public String
toString() {
173 StringBuffer output
= new StringBuffer();
174 output
.append("[EventInfo(");
175 output
.append(super.toString());
176 output
.append(",PID=");
178 output
.append(",Events=");
179 if (fEvents
.isEmpty()) {
180 output
.append("None");
182 for (Iterator
<IBaseEventInfo
> iterator
= fEvents
.iterator(); iterator
.hasNext();) {
183 IBaseEventInfo event
= iterator
.next();
184 output
.append(event
.toString());
188 return output
.toString();
This page took 0.036793 seconds and 5 git commands to generate.