diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/StatMan.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/console/StatMan.java')
| -rw-r--r-- | NET/worlds/console/StatMan.java | 58 |
1 files changed, 58 insertions, 0 deletions
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<Object> _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<Object> getChildren() { + return this._children; + } + + void addChild(StatMan child) { + assert child != null; + + if (this._children == null) { + this._children = new Vector<Object>(); + } + + assert this._children.indexOf(child) == -1; + + this._children.addElement(child); + if (this._tree != null) { + child.setTree(this._tree); + this._tree.update(); + } + } +} |