public HTNode(IHTNode right = null, IHTNode left = null, HTNode parent = null) { _Weight = 0; _Right = right; _Left = left; _Parent = parent; if (_Right != null) { _Right._Parent = this; } if (_Left != null) { _Left._Parent = this; } //if (_Parent == null) // code = ""; //else //{ // if (_Parent._Left == this) // code = "1" + _Parent.code; // else // code = "0" + _Parent.code; //} nodes.Add(this); }
public void TranslateToOrigin(HTNode node) { HTDrawNode drawNode = draw.FindDrawNode(node); draw.TranslateToOrigin(drawNode); return; }
public HTModelNode(HTNode node, HTModelNodeComposite parent, HTModel model) { this.node = node; this.parent = parent; this.model = model; model.IncrementNumberOfNodes(); z = new HTCoordE(); }
/* Inserts an item into the hash table */ internal void insertItem(int _key) { if (!searchItem(_key)) //Won't accept duplicates { int index = hashFunction(_key); //Calculating the index of a bucket table[index] = new HTNode(_key, table[index]); //Pushes a new node to the beginning of the bucket } }
public HTLeaf(HTNode parent, char c) { _Parent = parent; //code = _Parent.code; //if (_Parent._Left == this) // code = "1" + code; //else // code = "0" + code; sim = c; _Weight = 0; nodes.Add(this); }
public HTModel(HTNode root) { if (root.IsLeaf()) { this.root = new HTModelNode(root, this); //Debug.WriteLine("root:" + this.root); } else { this.root = new HTModelNodeComposite(root, this); //Debug.WriteLine("root:" + this.root); } this.root.LayoutHyperbolicTree(); }
/* Checks whether the key is present in the hash table */ internal bool searchItem(int _key) { bool found = false; int index = hashFunction(_key); HTNode walker = table[index]; //Getting a pointer to the first element of a bucket under a given index //Traversing and looking for the right key while (walker != null) { if (walker.key == _key) { found = true; break; } walker = walker.next; } return(found); }
public void Add(char c) { EscapeNode esc = (EscapeNode)nodes.Find(node => node is EscapeNode); HTNode oldEscParent = esc._Parent; HTNode newNode = new HTNode(null, esc, esc._Parent); if (oldEscParent != null) { oldEscParent._Left = newNode; } HTLeaf newLeaf = new HTLeaf(newNode, c); newNode._Right = newLeaf; //esc._Parent._Left = newNode; //if (newNode._Parent != null) // newNode.code = "1" + newNode._Parent.code; //else // newNode.code = "1"; //esc.code += "1"; //UpdateNodes(); }
public HTModelNodeComposite(HTNode node, HTModelNodeComposite parent, HTModel model) : base(node, parent, model) { this.children = new ObservableCollection<HTModelNode>(); HTNode childNode = null; HTModelNode child = null; for (IEnumerator i = node.Children(); i.MoveNext(); ) { childNode = (HTNode)i.Current; if (childNode.IsLeaf()) { child = new HTModelNode(childNode, this, model); //Debug.WriteLine("HTModelNode:" + child); } else { child = new HTModelNodeComposite(childNode, this, model); //Debug.WriteLine("HTModelNodeComposite:" + child); } AddChild(child); } ComputeWeight(); }
public HTModelNodeComposite(HTNode node, HTModelNodeComposite parent, HTModel model) : base(node, parent, model) { this.children = new ObservableCollection <HTModelNode>(); HTNode childNode = null; HTModelNode child = null; for (IEnumerator i = node.Children(); i.MoveNext();) { childNode = (HTNode)i.Current; if (childNode.IsLeaf()) { child = new HTModelNode(childNode, this, model); //Debug.WriteLine("HTModelNode:" + child); } else { child = new HTModelNodeComposite(childNode, this, model); //Debug.WriteLine("HTModelNodeComposite:" + child); } AddChild(child); } ComputeWeight(); }
public HyperTree(HTNode root) { model = new HTModel(root); }
internal HTDrawNode FindDrawNode(HTNode htNode) { HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode]; return(drawNode); }
internal void MapNode(HTNode htNode, HTDrawNode drawNode) { drawToHTNodeMap.Add(htNode, drawNode); return; }
public HTModelNode(HTNode node, HTModel model) : this(node,null,model) { }
internal HTNode(int _key, HTNode _next) { key = _key; next = _next; }
public HTModelNodeComposite(HTNode node, HTModel model) : this(node, null, model) { }
internal HTDrawNode FindDrawNode(HTNode htNode) { HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode]; return drawNode; }