IMPLEMENTATION MODULE Queue;

FROM List IMPORT List;

  CLASS Queue(Element);
    VAR
      TheList: List(Element);
      
    REDEFINE METHOD CREATE;
      BEGIN
      TheList.CREATE;
      END CREATE;
      
    METHOD Enqueue(El: Element);
      BEGIN
      TheList.Append (El);
      END Enqueue;
      
    METHOD Dequeue: Element;
      BEGIN
      ASSERT TheList.Size > 0;
      RESULT := TheList.Get(0);
      TheList.Delete(0);
      END Dequeue;
      
    METHOD Size: INTEGER;
      BEGIN
      RESULT := TheList.Size;
      END Size;
  END Queue;

END Queue;
