示例#1
0
                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;
        }
示例#3
0
        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
        }
    }
示例#5
0
        public HTModelNode(HTNode node, HTModelNodeComposite parent, HTModel model)
        {
            this.node   = node;
            this.parent = parent;
            this.model  = model;
            model.IncrementNumberOfNodes();

            z = new HTCoordE();
        }
示例#6
0
 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);
 }
示例#7
0
 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();
 }
示例#8
0
 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);
    }
示例#10
0
            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();
            }
示例#11
0
 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();
 }
示例#12
0
        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();
        }
示例#13
0
 public HyperTree(HTNode root)
 {
     model = new HTModel(root);
 }
示例#14
0
        internal HTDrawNode FindDrawNode(HTNode htNode)
        {
            HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode];

            return(drawNode);
        }
示例#15
0
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }
示例#16
0
 public HTModelNode(HTNode node, HTModel model)
     : this(node,null,model)
 {
 }
示例#17
0
 public HyperTree(HTNode root)
 {
     model = new HTModel(root);
 }
示例#18
0
 public void TranslateToOrigin(HTNode node)
 {
     HTDrawNode drawNode = draw.FindDrawNode(node);
     draw.TranslateToOrigin(drawNode);
     return;
 }
示例#19
0
 internal HTNode(int _key, HTNode _next)
 {
     key  = _key;
     next = _next;
 }
示例#20
0
 public HTModelNodeComposite(HTNode node, HTModel model) : this(node, null, model)
 {
 }
示例#21
0
 internal HTDrawNode FindDrawNode(HTNode htNode)
 {
     HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode];
     return drawNode;
 }
示例#22
0
 internal void MapNode(HTNode htNode, HTDrawNode drawNode)
 {
     drawToHTNodeMap.Add(htNode, drawNode);
     return;
 }