Exemplo n.º 1
0
            public int Add(MyV2IPair myV2IPair)
            {
                if (_IsPosEnd())
                {
                    _Expand();
                }
                data[currentPos] = new StorageTreeNode(myV2IPair.current);
                for (int i = 0; i < currentPos; i++)
                {
                    if (data[i].data == myV2IPair.previous)
                    {
                        data[currentPos].father = data[i];

                        StorageTreeNode[] tLeavesArray = new StorageTreeNode[data[i].leavesCount + 1];
                        for (int j = 0; i < data[i].leavesCount; j++)
                        {
                            tLeavesArray[j] = data[i].leaves[j];
                        }
                        tLeavesArray[data[i].leavesCount] = data[currentPos];
                        data[i].leaves = tLeavesArray;

                        break;
                    }
                }
                currentPos++;
                return(currentPos - 1);
            }
Exemplo n.º 2
0
 private void _Expand()
 {
     size *= 2;
     StorageTreeNode[] tdata = new StorageTreeNode[size];
     for (int i = 0; i < currentPos; i++)
     {
         tdata[i] = data[i];
     }
     data = tdata;
 }
Exemplo n.º 3
0
 public StorageTree()
 {
     size       = 64;
     data       = new StorageTreeNode[size];
     currentPos = 0;
 }