* The channels information of the domain.
*/
private List<IChannelInfo> fChannels = new ArrayList<IChannelInfo>();
+ private boolean fIsKernel = false;
// ------------------------------------------------------------------------
// Constructors
fChannels.add(other.fChannels.get(i));
}
}
+ fIsKernel = other.fIsKernel;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo#isKernel()
+ */
+ @Override
+ public boolean isKernel() {
+ return fIsKernel;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo#setIsKernel(boolean)
+ */
+ @Override
+ public void setIsKernel(boolean isKernel) {
+ fIsKernel = isKernel;
}
// ------------------------------------------------------------------------
fChannels.add(channel);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public String formatString() {
+ StringBuffer output = new StringBuffer();
+ //=== Domain: Kernel ===
+ output.append("\n=== Domain: ");
+ output.append(getName());
+ output.append(" ===\n");
+ output.append("\n");
+ // Channels:
+ output.append("Channels:\n");
+ // -------------
+ output.append("-------------");
+ if (fChannels.isEmpty()) {
+ output.append("\nNone");
+ } else {
+ for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
+ IChannelInfo channel = (IChannelInfo) iterator.next();
+ output.append(channel.formatString());
+ }
+ }
+ output.append("\n");
+ return output.toString();
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
*/
@Override
public int hashCode() {
- int result = 17;
- result = 37 * result + super.hashCode();
- for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
- IChannelInfo channel = (IChannelInfo) iterator.next();
- result = 37 * result + channel.hashCode();
- }
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((fChannels == null) ? 0 : fChannels.hashCode());
+ result = prime * result + (fIsKernel ? 1231 : 1237);
return result;
}
* @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object other) {
- if (!(other instanceof DomainInfo)) {
- return false;
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
}
-
- DomainInfo otherInfo = (DomainInfo) other;
- if (!super.equals(otherInfo)) {
+ if (!super.equals(obj)) {
return false;
}
-
- if (fChannels.size() != otherInfo.fChannels.size()) {
+ if (getClass() != obj.getClass()) {
return false;
}
- for (int i = 0; i < fChannels.size(); i++) {
- if (!fChannels.get(i).equals(otherInfo.fChannels.get(i))) {
+ DomainInfo other = (DomainInfo) obj;
+ if (fChannels == null) {
+ if (other.fChannels != null) {
return false;
}
+ } else if (!fChannels.equals(other.fChannels)) {
+ return false;
+ }
+ if (fIsKernel != other.fIsKernel) {
+ return false;
}
return true;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#toString()
output.append(channel.toString());
}
}
+ output.append(",isKernel=");
+ output.append(String.valueOf(fIsKernel));
output.append(")]");
return output.toString();
}
+
}