X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.lttng.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Flttng%2Fui%2Fviews%2Fcontrol%2Fmodel%2Fimpl%2FDomainInfo.java;h=1bf7994ba214eabab28f323bea84957e0e421b4e;hb=d132bcc71fa0ff07cf2a3f0b6258f38abb546fb7;hp=95c1d26366f3a6731937e183c00b78f7f6d92d48;hpb=f1e23c542e9b00f6dab15b7aa2960315a22d9bc4;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/DomainInfo.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/DomainInfo.java index 95c1d26366..1bf7994ba2 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/DomainInfo.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/DomainInfo.java @@ -114,19 +114,45 @@ public class DomainInfo extends TraceInfo implements IDomainInfo { 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 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 iterator = fChannels.iterator(); iterator.hasNext();) { - IChannelInfo channel = (IChannelInfo) iterator.next(); - result = 37 * result + channel.hashCode(); - } - result += 37 * result + (fIsKernel ? 1 : 0); + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((fChannels == null) ? 0 : fChannels.hashCode()); + result = prime * result + (fIsKernel ? 1231 : 1237); return result; } @@ -135,31 +161,30 @@ public class DomainInfo extends TraceInfo implements IDomainInfo { * @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 != otherInfo.fIsKernel) { + if (fIsKernel != other.fIsKernel) { return false; } return true; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#toString() @@ -184,4 +209,5 @@ public class DomainInfo extends TraceInfo implements IDomainInfo { output.append(")]"); return output.toString(); } + }