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 // ------------------------------------------------------------------------
36 * The process ID of the UST provider.
41 * List of event information.
43 private final List
<IBaseEventInfo
> fEvents
= new ArrayList
<>();
45 // ------------------------------------------------------------------------
47 // ------------------------------------------------------------------------
51 * @param name - name of UST provider
53 public UstProviderInfo(String name
) {
59 * @param other - the instance to copy
61 public UstProviderInfo(UstProviderInfo other
) {
64 for (Iterator
<IBaseEventInfo
> iterator
= other
.fEvents
.iterator(); iterator
.hasNext();) {
65 IBaseEventInfo event
= iterator
.next();
66 if (event
instanceof BaseEventInfo
) {
67 fEvents
.add(new BaseEventInfo((BaseEventInfo
)event
));
74 // ------------------------------------------------------------------------
76 // ------------------------------------------------------------------------
84 public void setPid(int pid
) {
89 public IBaseEventInfo
[] getEvents() {
90 return fEvents
.toArray(new IBaseEventInfo
[fEvents
.size()]);
94 public void setEvents(List
<IBaseEventInfo
> events
) {
96 for (Iterator
<IBaseEventInfo
> iterator
= events
.iterator(); iterator
.hasNext();) {
97 IBaseEventInfo eventInfo
= iterator
.next();
98 fEvents
.add(eventInfo
);
103 public void addEvent(IBaseEventInfo event
) {
107 // ------------------------------------------------------------------------
109 // ------------------------------------------------------------------------
112 public int hashCode() {
113 final int prime
= 31;
114 int result
= super.hashCode();
115 result
= prime
* result
+ fEvents
.hashCode();
116 result
= prime
* result
+ fPid
;
121 public boolean equals(Object obj
) {
125 if (!super.equals(obj
)) {
128 if (getClass() != obj
.getClass()) {
131 UstProviderInfo other
= (UstProviderInfo
) obj
;
132 if (!fEvents
.equals(other
.fEvents
)) {
135 if (fPid
!= other
.fPid
) {
141 @SuppressWarnings("nls")
143 public String
toString() {
144 StringBuffer output
= new StringBuffer();
145 output
.append("[EventInfo(");
146 output
.append(super.toString());
147 output
.append(",PID=");
149 output
.append(",Events=");
150 if (fEvents
.isEmpty()) {
151 output
.append("None");
153 for (Iterator
<IBaseEventInfo
> iterator
= fEvents
.iterator(); iterator
.hasNext();) {
154 IBaseEventInfo event
= iterator
.next();
155 output
.append(event
.toString());
159 return output
.toString();
This page took 0.035551 seconds and 6 git commands to generate.