Added a toString() set up to make it easy to stringify place manager

derived classes.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@285 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-21 01:07:19 +00:00
parent bee0ae1ddb
commit 4b0f742356
2 changed files with 34 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: PlaceManager.java,v 1.9 2001/08/20 20:54:57 mdb Exp $
// $Id: PlaceManager.java,v 1.10 2001/08/21 01:07:18 mdb Exp $
package com.threerings.cocktail.party.server;
@@ -222,6 +222,32 @@ public class PlaceManager implements Subscriber
return true;
}
/**
* Generates a string representation of this manager. Does so in a way
* that makes it easier for derived classes to add to the string
* representation.
*
* @see toString(StringBuffer)
*/
public String toString ()
{
StringBuffer buf = new StringBuffer();
buf.append("[");
toString(buf);
buf.append("]");
return buf.toString();
}
/**
* An extensible way to add to the string representation of this
* class. Override this (being sure to call super) and append your
* info to the buffer.
*/
protected void toString (StringBuffer buf)
{
buf.append("place=").append(_plobj);
}
/**
* An interface used to allow the registration of standard message
* handlers to be invoked by the place manager when particular types
@@ -1,5 +1,5 @@
//
// $Id: SceneManager.java,v 1.1 2001/08/11 04:09:50 mdb Exp $
// $Id: SceneManager.java,v 1.2 2001/08/21 01:07:19 mdb Exp $
package com.threerings.whirled.server;
@@ -34,6 +34,12 @@ public class SceneManager extends PlaceManager
_screg.sceneManagerDidInit(this);
}
protected void toString (StringBuffer buf)
{
super.toString(buf);
buf.append("scene=").append(_scene);
}
protected Scene _scene;
protected SceneRegistry _screg;
}