Added toString().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@680 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-11-29 19:32:06 +00:00
parent 4134683a40
commit 2c303a6e91
2 changed files with 41 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: SceneModel.java,v 1.2 2001/11/29 00:15:48 mdb Exp $
// $Id: SceneModel.java,v 1.3 2001/11/29 19:32:06 mdb Exp $
package com.threerings.whirled.data;
@@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import com.samskivert.util.StringUtil;
import com.threerings.presents.io.Streamable;
/**
@@ -80,4 +81,25 @@ public class SceneModel implements Streamable
model.version = 0;
model.neighborIds = new int[0];
}
/**
* Generates a string representation of this scene model.
*/
public String toString ()
{
StringBuffer buf = new StringBuffer("[");
toString(buf);
return buf.append("]").toString();
}
/**
* Derived classes override this to tack their <code>toString</code>
* data on to the string buffer.
*/
protected void toString (StringBuffer buf)
{
buf.append("sceneId=").append(sceneId);
buf.append(", version=").append(version);
buf.append(", neighborIds=").append(StringUtil.toString(neighborIds));
}
}
@@ -1,5 +1,5 @@
//
// $Id: SpotSceneModel.java,v 1.2 2001/11/29 00:16:46 mdb Exp $
// $Id: SpotSceneModel.java,v 1.3 2001/11/29 19:32:06 mdb Exp $
package com.threerings.whirled.spot.data;
@@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import com.samskivert.util.StringUtil;
import com.threerings.whirled.data.SceneModel;
/**
@@ -155,4 +156,20 @@ public class SpotSceneModel extends SceneModel
model.portalIds = new int[0];
model.targetLocIds = new int[0];
}
// documentation inherited
protected void toString (StringBuffer buf)
{
super.toString(buf);
buf.append(", locationIds=").append(StringUtil.toString(locationIds));
buf.append(", locationX=").append(StringUtil.toString(locationX ));
buf.append(", locationY=").append(StringUtil.toString(locationY));
buf.append(", locationOrients=").
append(StringUtil.toString(locationOrients));
buf.append(", locationClusters=").
append(StringUtil.toString(locationClusters));
buf.append(", defaultEntranceId=").append(defaultEntranceId);
buf.append(", portalIds=").append(StringUtil.toString(portalIds));
buf.append(", targetLocIds=").append(StringUtil.toString(targetLocIds));
}
}