//************************************************************************* // Method: PopulateTreeMap() // /// <summary> /// Populates map from hash data /// </summary> //************************************************************************* public void PopulateTreeMap(Hashtable wordsHash, Hashtable stemmedWordsHash) { AssertValid(); ArrayList nodes = new ArrayList(); ArrayList aKeys = new ArrayList(stemmedWordsHash.Keys); aKeys.Sort(); foreach (string key in aKeys) { //build each node element int count = (int)stemmedWordsHash[key]; string name = (string)wordsHash[key]; //show count in node? if(m_bShowWordCount) name += String.Format(" ({0})", count); NodeInfo nodeinfo = new NodeInfo(name, count); nodes.Add(nodeinfo); } m_nodes = nodes; RepopulateTreeMap(); }
//************************************************************************* // Method: InitTree() // /// <summary> /// Add initial node to tree when app starts /// </summary> //************************************************************************* public void InitTree() { //add one root node at startup ArrayList nodes = new ArrayList(); NodeInfo nodeinfo = new NodeInfo("", 5); nodes.Add(nodeinfo); m_nodes = nodes; RepopulateTreeMap(); }