/* Author : Rick van der Zwet * S-number : 0433373 * Version : $Id: trie.h 322 2007-11-22 14:09:00Z rick $ * Copyright : FreeBSD Licence */ #ifndef TRIE_H #define TRIE_H template class TrieNode { public: TrieNode(); ~TrieNode(); InfoTp Value; // Value of TrieNode TrieNode *One, // Pointer to node if bit is set 1 *Zero, // Pointer to node if bit is set 0 *Parent; // Pointer to parent node }; template class Trie { public: // Constructor, create new Trie, only root Trie (); // Destructor ~Trie (); //Test wether window is at leaf bool AtLeaf (); // Place window on Root void GoRoot (); // Check wether current knob has child K bool ExistsChild (char K); // Place window at child K of current knob void GoChild (char K); // First child of current knob, '\0' if child has no children char FirstChild (); // Get next child of current knob, '\0' if none char NextChild (char K); // Add child K, if already exists do nothing void AddChild (char K); // Remove child, do nothing if not exists void RemoveChild (char K); // Place information in current knob void PutInfo (InfoTp I); // Get information of current knob InfoTp GetInfo (); // PLace window of knob provided void GotoNode (TrieNode *Nd); // Get address of current knob TrieNode *GetNode (); private: TrieNode *Window, //het venster *NodeFound, //store value node if exists *Root; //de wortel }; #endif