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%2FTraceInfo.java;h=851478ff996316f5b68414cb6237198d10941d61;hb=d132bcc71fa0ff07cf2a3f0b6258f38abb546fb7;hp=5ae5e2e0f00da1439031ca183a94160d69b532d0;hpb=f1e23c542e9b00f6dab15b7aa2960315a22d9bc4;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceInfo.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceInfo.java index 5ae5e2e0f0..851478ff99 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceInfo.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceInfo.java @@ -77,16 +77,25 @@ public class TraceInfo implements ITraceInfo { fName = name; } + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString() + */ + @Override + public String formatString() { + return toString(); + } + /* * (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { - if (fName == null) { - return 17; - } - return fName.hashCode(); + final int prime = 31; + int result = 1; + result = prime * result + ((fName == null) ? 0 : fName.hashCode()); + return result; } /* @@ -94,15 +103,26 @@ public class TraceInfo implements ITraceInfo { * @see java.lang.Object#equals(java.lang.Object) */ @Override - public boolean equals(Object other) { - if (!(other instanceof TraceInfo)) { + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { return false; } - - TraceInfo otherInfo = (TraceInfo) other; - return fName.equals(otherInfo.fName); - } - + if (getClass() != obj.getClass()) { + return false; + } + TraceInfo other = (TraceInfo) obj; + if (fName == null) { + if (other.fName != null) { + return false; + } + } else if (!fName.equals(other.fName)) { + return false; + } + return true; + } /* * (non-Javadoc) * @see java.lang.Object#toString()