예제 #1
0
 public void Insert(Conjunct newConjunct)
 {
     if (!ListOfConjuncts.Contains(newConjunct))
     {
         ListOfConjuncts.Add(newConjunct);
     }
 }
예제 #2
0
        public bool Contains(Conjunct conj)
        {
            var current = Head;

            while (current != null)
            {
                if (current.Data.Equals(conj))
                {
                    return(true);
                }
                current = current.Next;
            }
            return(false);
        }
예제 #3
0
        public void Add(Conjunct item)

        {
            Node node = new Node()
            {
                Data = item
            };

            if (Head == null)
            {
                Head = Tail = node;
            }
            else
            {
                Tail.Next = node;
                Tail      = node;
            }

            Count++;
        }
예제 #4
0
        public bool Remove(Conjunct item)
        {
            Node previous = null;

            Node current = Head;

            while (current != null)
            {
                if (current.Data.Equals(item))
                {
                    if (previous != null)
                    {
                        previous.Next = current.Next;
                        if (current.Next == null)
                        {
                            Tail = previous;
                        }
                    }
                    else
                    {
                        Head = Head.Next;
                        if (Head == null)
                        {
                            Tail = null;
                        }
                    }

                    Count--;
                    return(true);
                }

                previous = current;
                current  = current.Next;
            }
            return(false);
        }
예제 #5
0
 public Node(Conjunct value)
 {
     Data = value;
 }