示例#1
0
        public void remove(string name)
        {
            if (processes.getChain() != null && processes.getChain().getData().getName() == name)
            {
                node temp = processes.getChain();
                processes.setChain(processes.getChain().getNext());
                temp = new node();
                if (processes.getChain() == null)
                {
                    processes.setTail(null);
                }
                return;
            }
            node p1 = processes.getChain();
            node p2 = processes.getChain().getNext();
            node p3 = new node();

            if (p2.getNext() != null)
            {
                p3 = p2.getNext();
            }
            while (p2 != null)
            {
                if (p2.getData().getName() == name)
                {
                    p1.setNext(p2.getNext());
                    p3.setPrevious(p2.getPrevious());
                    p2 = new node();
                    break;
                }
                p1 = p1.getNext();
                p2 = p2.getNext();
            }
        }
示例#2
0
        public void addtoEnd(Process data1)
        {
            node temp = new node(data1);

            if (tail != null)
            {
                tail.setNext(temp);
                temp.setPrevious(tail);
            }
            tail = temp;
            if (chain == null)
            {
                chain = tail;
            }
        }
示例#3
0
        public void add(Process data1)
        {
            node temp = new node(data1);

            temp.setNext(chain);
            if (chain != null)
            {
                chain.setPrevious(temp);
            }
            chain = temp;
            if (tail == null)
            {
                tail = chain;
            }
        }