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%2FUstProviderInfo.java;h=c3d4b4cec7a402c62b32281246bc073b8cd2dd11;hb=d132bcc71fa0ff07cf2a3f0b6258f38abb546fb7;hp=537d7341177f2b1c980366affc9521d52f5d1a5f;hpb=f1e23c542e9b00f6dab15b7aa2960315a22d9bc4;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderInfo.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderInfo.java index 537d734117..c3d4b4cec7 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderInfo.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderInfo.java @@ -125,16 +125,37 @@ public class UstProviderInfo extends TraceInfo implements IUstProviderInfo { /* * (non-Javadoc) - * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode() + * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString() */ + @SuppressWarnings("nls") @Override - public int hashCode() { - int result = 17; - result = 37 * result + super.hashCode(); + public String formatString() { + StringBuffer output = new StringBuffer(); + //PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + output.append("\nPID: "); + output.append(fPid); + output.append(" - Name: "); + output.append(getName()); for (Iterator iterator = fEvents.iterator(); iterator.hasNext();) { IBaseEventInfo event = (IBaseEventInfo) iterator.next(); - result = 37 * result + event.hashCode(); + output.append(event.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() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((fEvents == null) ? 0 : fEvents.hashCode()); + result = prime * result + fPid; return result; } @@ -143,23 +164,26 @@ public class UstProviderInfo extends TraceInfo implements IUstProviderInfo { * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object) */ @Override - public boolean equals(Object other) { - if (!(other instanceof UstProviderInfo)) { - return false; + public boolean equals(Object obj) { + if (this == obj) { + return true; } - - UstProviderInfo otherUstInfo = (UstProviderInfo) other; - if (!super.equals(otherUstInfo)) { + if (!super.equals(obj)) { return false; } - - if (fEvents.size() != otherUstInfo.fEvents.size()) { + if (getClass() != obj.getClass()) { return false; } - for (int i = 0; i < fEvents.size(); i++) { - if (!fEvents.get(i).equals(otherUstInfo.fEvents.get(i))) { + UstProviderInfo other = (UstProviderInfo) obj; + if (fEvents == null) { + if (other.fEvents != null) { return false; } + } else if (!fEvents.equals(other.fEvents)) { + return false; + } + if (fPid != other.fPid) { + return false; } return true; } @@ -188,4 +212,6 @@ public class UstProviderInfo extends TraceInfo implements IUstProviderInfo { output.append(")]"); return output.toString(); } + + }