1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[291548] DMContext.toString() not handling multi-parent scenario well

This commit is contained in:
John Cortell 2009-10-07 02:24:45 +00:00
parent cdf996fee1
commit e61498f16f

View file

@ -86,11 +86,25 @@ abstract public class AbstractDMContext extends PlatformObject
}
return getSessionId().hashCode() + parentsHash;
}
/**
* @return a stringified representation of our parent context. If we have
* more than one parent, the parents are separated by commas, and
* the entire collection is wrapped with parenthesis:
* "(p1,p2,...,pn)"
*/
protected String baseToString() {
StringBuffer retVal = new StringBuffer();
StringBuilder retVal = new StringBuilder();
for (IDMContext parent : fParents) {
retVal.append(parent);
retVal.append(',');
}
if (retVal.length() > 0) {
retVal.deleteCharAt(retVal.length() - 1); // remove trailing comma
}
if (fParents.length > 1) {
retVal.insert(0, '(');
retVal.insert(retVal.length(), ')');
}
return retVal.toString();
}