Exemple #1
0
        public void removeByName(string name)
        {
            process tmp = head;

            if (size() == 1)
            {
                head = null;
                return;
            }
            else if (tmp.get_processName() == name)
            {
                head = tmp.get_next();
                return;
            }
            else
            {
                tmp = tmp.get_next();
                while (tmp.get_processName() != name && tmp.get_next() != null)
                {
                    tmp = tmp.get_next();
                }
                process tmp2 = tmp.get_next();
                tmp.set_next(tmp2.get_next());
            }
        }
Exemple #2
0
        public int[] allEle(int j)
        {
            process tmp = head;
            int     s   = size();

            int[] arr = new int[s];
            if (j == 0)
            {
                for (int i = 0; i < s; i++)
                {
                    arr[i] = tmp.get_start();
                    tmp    = tmp.get_next();
                }
            }
            else if (j == 1)
            {
                for (int i = 0; i < s; i++)
                {
                    arr[i] = tmp.get_end();
                    tmp    = tmp.get_next();
                }
            }
            else if (j == 2)
            {
                for (int i = 0; i < s; i++)
                {
                    arr[i] = tmp.get_size();
                    tmp    = tmp.get_next();
                }
            }


            return(arr);
        }
Exemple #3
0
        public process last()
        {
            if (isEmpty())
            {
                return(null);
            }
            process tmp = head;

            while (tmp.get_next() != null)
            {
                tmp = tmp.get_next();
            }
            return(tmp);
        }
Exemple #4
0
        public void removeByStart(int i)
        {
            process tmp  = findByStart(i);
            process tmp2 = tmp.get_next().get_next();

            tmp.set_next(tmp2);
        }
Exemple #5
0
        public process findByName(string i)
        {
            process tmp = head;

            while (tmp.get_processName() != i)
            {
                tmp = tmp.get_next();
            }
            return(tmp);
        }
Exemple #6
0
        public process findBySize(int i)
        {
            process tmp = head;

            while (tmp.get_size() != i)
            {
                tmp = tmp.get_next();
            }
            return(tmp);
        }
Exemple #7
0
        public process findByEnd(int i)
        {
            process tmp = head;

            while (tmp.get_end() != i)
            {
                tmp = tmp.get_next();
            }
            return(tmp);
        }
Exemple #8
0
        public void remove(process p)
        {
            process tmp = head;

            if (size() == 1)
            {
                head = null;
                return;
            }
            else if (tmp == p)
            {
                head = tmp.get_next();
                return;
            }
            else
            {
                while (tmp.get_next() != p && tmp.get_next() != null)
                {
                    tmp = tmp.get_next();
                }
                process tmp2 = tmp.get_next();
                tmp.set_next(tmp2.get_next());
            }
        }
        public void printPro()
        {
            mPro.sort(0);
            process pro  = mPro.get_hProcess();
            int     size = mPro.size();

            for (int i = 0; i < size; i++)
            {
                string proName = pro.get_processName();
                int    start   = pro.get_start();
                int    end     = pro.get_end();
                listBox2.Items.Add(proName + "    from    " + start + "    to    " + end);
                pro = pro.get_next();
            }
            printHoles();
        }
Exemple #10
0
        public int processlistSize()
        {
            if (isEmpty())
            {
                return(0);
            }
            process tmp = head;
            int     i   = 0;

            while (tmp != null)
            {
                i   = i + tmp.get_size();
                tmp = tmp.get_next();
            }
            return(i);
        }
Exemple #11
0
        public int size()
        {
            if (isEmpty())
            {
                return(0);
            }
            int     i   = 1;
            process tmp = head.get_next();

            while (tmp != null)
            {
                i++;
                tmp = tmp.get_next();
            }
            return(i);
        }
Exemple #12
0
        public void sort(int sel)
        {
            process tmp = head;
            int     n = size();
            int     x, y;

            if (sel == 0)
            {
                for (x = 0; x < n; x++)
                {
                    process tmp2 = tmp.get_next();
                    for (y = 0; y < n - x - 1; y++)
                    {
                        int c  = tmp.get_start();
                        int nn = tmp2.get_start();
                        if (c > nn)
                        {
                            swap(tmp, tmp2);
                        }

                        tmp2 = tmp2.get_next();
                    }
                    tmp = tmp.get_next();
                }
            }
            else if (sel == 1)
            {
                for (x = 0; x < n; x++)
                {
                    process tmp2 = tmp.get_next();
                    for (y = 0; y < n - x - 1; y++)
                    {
                        int c  = tmp.get_end();
                        int nn = tmp2.get_end();
                        if (c > nn)
                        {
                            swap(tmp, tmp2);
                        }

                        tmp2 = tmp2.get_next();
                    }
                    tmp = tmp.get_next();
                }
            }
            else if (sel == 2)
            {
                for (x = 0; x < n; x++)
                {
                    process tmp2 = tmp.get_next();
                    for (y = 0; y < n - x - 1; y++)
                    {
                        int c  = tmp.get_size();
                        int nn = tmp2.get_size();
                        if (c > nn)
                        {
                            swap(tmp, tmp2);
                        }

                        tmp2 = tmp2.get_next();
                    }
                    tmp = tmp.get_next();
                }
            }
        }