Mercurial > hg > Members > shoshi > TreeCMSv2
view src/treecms/memory/OnMemoryTree.java @ 6:12604eb6b615
added javadoc
author | shoshi |
---|---|
date | Mon, 14 Mar 2011 23:24:38 +0900 |
parents | f5ed85be5640 |
children | fc19e38b669b |
line wrap: on
line source
package treecms.memory; import java.util.LinkedList; import java.util.concurrent.ConcurrentHashMap; import treecms.api.Forest; import treecms.api.Node; import treecms.api.NodeData; import treecms.api.NodeID; import treecms.api.Tree; import treecms.tree.util.PreorderTreewalker; public class OnMemoryTree implements Tree { OnMemoryNode m_root; OnMemoryForest m_forest; ConcurrentHashMap<String,OnMemoryNode> m_table; public OnMemoryTree(OnMemoryNode _newRoot,OnMemoryForest _forest) { m_root = _newRoot; m_forest = _forest; m_table = new ConcurrentHashMap<String,OnMemoryNode>(); for(Node elem : new PreorderTreewalker(m_root)){ m_table.put(elem.getID().getUUID(),(OnMemoryNode)elem); } } @Override public Forest getForest() { return m_forest; } @Override public NodeID getID() { return m_root.getID(); } @Override public NodeData getData() { return m_root.getData(); } @Override public Node getNodeByUUID(String _uuid) { return m_table.get(_uuid); } }