/**********************************************************************
- * Copyright (c) 2012 Ericsson
- *
+ * Copyright (c) 2012, 2013 Ericsson
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
/**
* <p>
* Implementation of the trace domain interface (IDomainInfo) to store domain
- * related data.
+ * related data.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class DomainInfo extends TraceInfo implements IDomainInfo {
/**
* The channels information of the domain.
*/
- private List<IChannelInfo> fChannels = new ArrayList<IChannelInfo>();
+ private final List<IChannelInfo> fChannels = new ArrayList<IChannelInfo>();
private boolean fIsKernel = false;
// ------------------------------------------------------------------------
}
fIsKernel = other.fIsKernel;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#isKernel()
- */
+
@Override
public boolean isKernel() {
return fIsKernel;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#setIsKernel(boolean)
- */
+
@Override
public void setIsKernel(boolean isKernel) {
fIsKernel = isKernel;
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#getChannels()
- */
+
@Override
public IChannelInfo[] getChannels() {
return fChannels.toArray(new IChannelInfo[fChannels.size()]);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#setChannels(java.util.List)
- */
@Override
public void setChannels(List<IChannelInfo> channels) {
+ fChannels.clear();
for (Iterator<IChannelInfo> iterator = channels.iterator(); iterator.hasNext();) {
- IChannelInfo channelInfo = (IChannelInfo) iterator.next();
+ IChannelInfo channelInfo = iterator.next();
fChannels.add(channelInfo);
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#addChannel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo)
- */
@Override
public void addChannel(IChannelInfo channel) {
fChannels.add(channel);
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
- */
+
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((fChannels == null) ? 0 : fChannels.hashCode());
+ result = prime * result + fChannels.hashCode();
result = prime * result + (fIsKernel ? 1231 : 1237);
return result;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (this == obj) {
return false;
}
DomainInfo other = (DomainInfo) obj;
- if (fChannels == null) {
- if (other.fChannels != null) {
- return false;
- }
- } else if (!fChannels.equals(other.fChannels)) {
+ if (!fChannels.equals(other.fChannels)) {
return false;
}
if (fIsKernel != other.fIsKernel) {
return true;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
- */
@SuppressWarnings("nls")
@Override
public String toString() {
output.append("None");
} else {
for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
- IChannelInfo channel = (IChannelInfo) iterator.next();
+ IChannelInfo channel = iterator.next();
output.append(channel.toString());
}
}
output.append(")]");
return output.toString();
}
-
+
}