예제 #1
0
파일: StrList.cs 프로젝트: jbw716/CMPS390
        public void sortAdd(string name)
        {
            if (empty)
            {
                add(name);
            }
            else
            {
                bool doIt = true;
                for (int i = 0; i <= end; i++)
                {
                    if (makeNameCode(getAt(i)) > makeNameCode(name))
                    {
                        if (i == 0)
                        {
                            StrNode tmp = front;
                            front = new StrNode(name);
                            front.setNext(tmp);
                            end++;
                        }
                        else
                        {
                            insertAfter(i - 1, name);
                        }
                        doIt = false;
                        break;
                    }
                }

                if (doIt)
                {
                    add(name);
                }
            }
        }
예제 #2
0
파일: StrList.cs 프로젝트: jbw716/CMPS390
        public void insertAfter(int index, string value)
        {
            StrNode workingStrNode = getStrNodeAt(index);
            StrNode temp           = workingStrNode.getNext();

            StrNode newStrNode = new StrNode(value);

            newStrNode.setNext(temp);

            workingStrNode.setNext(newStrNode);

            end++;
        }
예제 #3
0
파일: StrList.cs 프로젝트: jbw716/CMPS390
        public void add(string d)
        {
            if (empty)
            {
                front = new StrNode(d);
                empty = false;
            }
            else
            {
                getStrNodeAt(end).setNext(new StrNode(d));
            }

            end++;
        }
예제 #4
0
파일: StrList.cs 프로젝트: jbw716/CMPS390
        public void delAt(int index)
        {
            if (index == 0)
            {
                front = front.getNext();
            }
            else
            {
                getStrNodeAt(index - 1).setNext(getStrNodeAt(index).getNext());
            }

            end--;

            if (end == -1)
            {
                empty = true;
            }
        }
예제 #5
0
파일: StrList.cs 프로젝트: jbw716/CMPS390
 public void setNext(StrNode d)
 {
     next = d;
 }
예제 #6
0
파일: StrList.cs 프로젝트: jbw716/CMPS390
 public StrNode(string d)
 {
     data = d;
     next = null;
 }