From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/console/StatMan.java | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 NET/worlds/console/StatMan.java (limited to 'NET/worlds/console/StatMan.java') diff --git a/NET/worlds/console/StatMan.java b/NET/worlds/console/StatMan.java new file mode 100644 index 0000000..f8567bc --- /dev/null +++ b/NET/worlds/console/StatMan.java @@ -0,0 +1,58 @@ +package NET.worlds.console; + +import java.awt.List; +import java.util.Vector; + +abstract class StatMan { + protected Vector _children; + protected List _grabbedList; + protected Tree _tree; + + void createList() { + this.updateList(); + } + + abstract void updateList(); + + void releaseList(boolean terminalCallback) { + this._grabbedList = null; + } + + void grabList(List list) { + assert this._grabbedList == null; + + this._grabbedList = list; + this._grabbedList.removeAll(); + this.createList(); + } + + void setTree(Tree tree) { + this._tree = tree; + if (this._children != null) { + for (int i = this._children.size() - 1; i >= 0; i--) { + StatMan child = (StatMan)this._children.elementAt(i); + child.setTree(this._tree); + } + } + } + + Vector getChildren() { + return this._children; + } + + void addChild(StatMan child) { + assert child != null; + + if (this._children == null) { + this._children = new Vector(); + } + + assert this._children.indexOf(child) == -1; + + this._children.addElement(child); + if (this._tree != null) { + child.setTree(this._tree); + this._tree.update(); + } + } +} -- cgit v1.2.3