Provide an easy way to add to toString() info.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3806 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-01-17 23:28:21 +00:00
parent bf5fff9ee1
commit d67825b213
+18 -6
View File
@@ -377,12 +377,24 @@ public class Table
*/
public String toString ()
{
return "[tableId=" + tableId +
", lobbyOid=" + lobbyOid +
", gameOid=" + gameOid +
", occupants=" + StringUtil.toString(occupants) +
", bodyOids=" + StringUtil.toString(bodyOids) +
", config=" + config + "]";
StringBuffer buf = new StringBuffer();
buf.append(StringUtil.shortClassName(this));
buf.append(" [");
toString(buf);
buf.append("]");
return buf.toString();
}
/**
* Helper method for toString, ripe for overrideability.
*/
protected void toString (StringBuffer buf)
{
buf.append("tableId=").append(tableId);
buf.append(", lobbyOid=").append(lobbyOid);
buf.append(", gameOid=").append(gameOid);
buf.append(", occupants=").append(StringUtil.toString(occupants));
buf.append(", config=").append(config);
}
/** A counter for assigning table ids. */