1 /**********************************************************************
2 * Copyright (c) 2012 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
;
22 * <b><u>UstProviderInfo</u></b>
24 * Implementation of the Ust Provider interface (IUstProviderInfo) to store UST
25 * provider related data.
28 public class UstProviderInfo
extends TraceInfo
implements IUstProviderInfo
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 * The process ID of the UST provider.
38 * List of event information.
40 private List
<IBaseEventInfo
> fEvents
= new ArrayList
<IBaseEventInfo
>();
42 // ------------------------------------------------------------------------
44 // ------------------------------------------------------------------------
47 * @param name - name of UST provider
49 public UstProviderInfo(String name
) {
55 * @param other - the instance to copy
57 public UstProviderInfo(UstProviderInfo other
) {
60 for (Iterator
<IBaseEventInfo
> iterator
= other
.fEvents
.iterator(); iterator
.hasNext();) {
61 IBaseEventInfo event
= iterator
.next();
62 if (event
instanceof BaseEventInfo
) {
63 fEvents
.add(new BaseEventInfo((BaseEventInfo
)event
));
70 // ------------------------------------------------------------------------
72 // ------------------------------------------------------------------------
76 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#getPid()
85 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#setPid(int)
88 public void setPid(int pid
) {
94 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#getEvents()
97 public IBaseEventInfo
[] getEvents() {
98 return fEvents
.toArray(new IBaseEventInfo
[fEvents
.size()]);
103 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#setEvents(java.util.List)
106 public void setEvents(List
<IBaseEventInfo
> events
) {
107 for (Iterator
<IBaseEventInfo
> iterator
= events
.iterator(); iterator
.hasNext();) {
108 IBaseEventInfo eventInfo
= (IBaseEventInfo
) iterator
.next();
109 fEvents
.add(eventInfo
);
115 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo#addEvent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IBaseEventInfo)
118 public void addEvent(IBaseEventInfo event
) {
122 // ------------------------------------------------------------------------
124 // ------------------------------------------------------------------------
128 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
131 public int hashCode() {
132 final int prime
= 31;
133 int result
= super.hashCode();
134 result
= prime
* result
+ ((fEvents
== null) ?
0 : fEvents
.hashCode());
135 result
= prime
* result
+ fPid
;
141 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
144 public boolean equals(Object obj
) {
148 if (!super.equals(obj
)) {
151 if (getClass() != obj
.getClass()) {
154 UstProviderInfo other
= (UstProviderInfo
) obj
;
155 if (fEvents
== null) {
156 if (other
.fEvents
!= null) {
159 } else if (!fEvents
.equals(other
.fEvents
)) {
162 if (fPid
!= other
.fPid
) {
170 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
172 @SuppressWarnings("nls")
174 public String
toString() {
175 StringBuffer output
= new StringBuffer();
176 output
.append("[EventInfo(");
177 output
.append(super.toString());
178 output
.append(",PID=");
180 output
.append(",Events=");
181 if (fEvents
.isEmpty()) {
182 output
.append("None");
184 for (Iterator
<IBaseEventInfo
> iterator
= fEvents
.iterator(); iterator
.hasNext();) {
185 IBaseEventInfo event
= (IBaseEventInfo
) iterator
.next();
186 output
.append(event
.toString());
190 return output
.toString();
This page took 0.035232 seconds and 6 git commands to generate.