Esempio n. 1
0
 public HeadNode(char val)
 {
     this.value = val;
     this.Head  = null;
     this.Tail  = null;
     this.dnode = null;
 }
Esempio n. 2
0
        public HeadNode ForwardGo(char val)
        {
            HeadNode h = Header;

            while (h.storeValue != val)
            {
                h = h.storeNxt;
            }
            return(h);
        }
Esempio n. 3
0
        public void ReversePrint()
        {
            HeadNode printNode = Pointer;

            while (printNode != null)
            {
                Console.WriteLine(printNode.storeValue);
                printNode = printNode.storePrv;
            }
        }
Esempio n. 4
0
        public HeadNode ReverseGo(char val)
        {
            HeadNode curr = Pointer;

            while (curr.storeValue != val && curr.storePrv != null)
            {
                Console.WriteLine(curr.storeValue);
                curr = curr.storePrv;
            }
            return(curr);
        }
Esempio n. 5
0
        public bool IsAvailableIndex(char Value)
        {
            HeadNode xway = Header;

            // Node yway = Header.storeDnode;

            while (xway != null && Value != xway.storeValue)
            {
                xway = xway.storeNxt;
            }
            return(xway != null);
        }
Esempio n. 6
0
 public void CreateXLinkedList()
 {
     for (int k = 65; k <= 91; k++)
     {
         char     val = (char)k;
         HeadNode n   = new HeadNode(val);
         if (Header == null)
         {
             Header  = n;
             Pointer = n;
             dnode   = null;
         }
         else
         {
             Pointer.storeNxt = n;
             n.storePrv       = Pointer;
             Pointer          = Pointer.storeNxt;
         }
     }
 }
Esempio n. 7
0
        public bool IsEmailAlreadyExists(string email)
        {
            HeadNode printNode = Header;
            DataNode dn;

            while (printNode != null)
            {
                dn = printNode.storeDnode;
                while (dn != null)
                {
                    if (dn.storeEmail == email)
                    {
                        return(true);
                    }
                    dn = dn.storeNext;
                }
                printNode = printNode.storeNxt;
            }
            return(false);
        }
Esempio n. 8
0
        public DataNode[] GetAllContacts()
        {
            DataNode[] d         = new DataNode[10];
            int        i         = 0;
            HeadNode   printNode = Header;
            DataNode   dn;

            while (printNode != null)
            {
                dn = printNode.storeDnode;
                while (dn != null)
                {
                    d[i] = dn;
                    i++;
                    dn = dn.storeNext;
                }
                printNode = printNode.storeNxt;
            }
            return(d);
        }
Esempio n. 9
0
        public void SaveAllContacts()
        {
            DataNode[] d         = new DataNode[10];
            int        i         = 0;
            HeadNode   printNode = Header;
            DataNode   dn;

            while (printNode != null)
            {
                dn = printNode.storeDnode;
                while (dn != null)
                {
                    d[i] = dn;
                    i++;
                    dn = dn.storeNext;
                }
                char a = printNode.storeValue;

                printNode = printNode.storeNxt;
                SaveToFile(a, d);
            }
        }
Esempio n. 10
0
        public void Print()
        {
            char[]   a = new char[26];
            string[] b = new string[100];



            for (HeadNode printNode = Header; printNode != null; printNode = printNode.storeNxt)
            {
                Console.WriteLine("HeadNode Value :" + printNode.storeValue);
                // Console.WriteLine("Contacts Found: " + printNode.GetSize);
                for (DataNode dn = printNode.storeDnode; dn != null; dn = dn.storeNext)
                {
                    Console.WriteLine("First Name:  " + dn.storeFname);
                    Console.WriteLine("Last Name:" + dn.storeLname);
                    Console.WriteLine("Full Name : " + dn.storeFname + "  " + dn.storeLname);
                    Console.WriteLine("Num : " + dn.storeCnum);
                    Console.WriteLine("Email:  " + dn.storeEmail);
                    Console.WriteLine("Address: " + dn.storeAddress);
                }
            }
        }
Esempio n. 11
0
        public DataNode[] SearchContact(string Name)
        {
            Name = Name.ToUpper();
            DataNode[] d         = new DataNode[10];
            int        i         = 0;
            HeadNode   printNode = Header;
            DataNode   dn;

            while (printNode != null)
            {
                dn = printNode.storeDnode;
                while (dn != null)
                {
                    if (dn.storeFname == Name || dn.storeLname == Name || dn.storeFname + " " + dn.storeLname == Name)
                    {
                        d[i] = dn;
                        i++;
                    }
                    dn = dn.storeNext;
                }
                printNode = printNode.storeNxt;
            }
            return(d);
        }
Esempio n. 12
0
 public MainClass()
 {
     Header  = null;
     Pointer = null;
     dnode   = null;
 }