Exemplo n.º 1
0
        public string[] GetAllMembers()
        {
            SNode t = Head;

            string[] members = new string[Count];

            for (int i = 0; i < Count; i++)
            {
                members[i] += t.Address;
                t           = t.Next;
            }
            return(members);
        }
Exemplo n.º 2
0
        //for Selecting Exact Object
        public string SearchByName(string _name)
        {
            SNode t = Head;

            while (t != null)
            {
                if (t.Name == _name)
                {
                    return(t.Address);
                }
                t = t.Next;
            }
            return(null);
        }
Exemplo n.º 3
0
        public string SelectRandomObject()
        {
            SNode t = Head;

            Random rm    = new Random();
            int    index = rm.Next(0, Count - 1);

            for (int i = 0; i <= index; i++)
            {
                if (i == index)
                {
                    return(t.Address);
                }
                t = t.Next;
            }

            return(null);
        }
Exemplo n.º 4
0
        public void Add(string val)
        {
            if (!String.IsNullOrWhiteSpace(val))
            {
                SNode node = new SNode(val);

                if (Head == null)
                {
                    Head = node;
                    Tail = node;
                    count++;
                }

                else
                {
                    Tail.Next = node;
                    Tail      = Tail.Next;
                    count++;
                }
            }
        }
Exemplo n.º 5
0
        public void Remove(string val)
        {
            SNode t = Head;

            if (t.Name == val)
            {
                Head = Head.Next;
                count--;
                return;
            }

            while (t.Next != null)
            {
                if (t.Next.Name == val)
                {
                    t.Next = t.Next.Next;
                    count--;
                    return;
                }
                t = t.Next;
            }
        }
 public SNode(string info)
 {
     this.Address = info;
     this.Name    = Path.GetFileName(info);
     this.Next    = null;
 }
Exemplo n.º 7
0
 public SLLIST()
 {
     Head = null;
     Tail = null;
 }