Пример #1
0
 /// 
 /// This function will print everything that is currently in the 
 /// PaymentQueue. 
 /// 
 public void printQueue()
 {
     temp = front;
     while (temp != null)
     {
         Console.WriteLine("{0}", temp.Value.ToString());
         temp = temp.Next;
     }
 }
Пример #2
0
 /// 
 /// This function will append to the end of the PaymentQueue or 
 /// create the first Node instance.
 /// 
 ///  
 public void append(PaymentRecord obj)
 {
     if (count == 0)
     {
         front = end = new Node(obj, front);
     }
     else
     {
         end.Next = new Node(obj, end.Next);
         end = end.Next;
     }
     count++;
 }
Пример #3
0
 /// 
 /// This function will serve from the front of the PaymentQueue.  Notice
 /// no deallocation for the Node Class, This is now handled by the 
 /// Garbage Collector.
 /// 
 public object serve()
 {
     temp = front;
     if (count == 0)
         throw new Exception("tried to serve from an empty PaymentQueue");
     front = front.Next;
     count--;
     return temp.Value;
 }
Пример #4
0
 public Node(PaymentRecord value, Node next)
 {
     Next = next;
     Value = value;
 }