(* source: h:\modula\code\queues\QueData.DEF  v1.0a         revised: 88.07.19
   author: G.Greene, AGCS D/429 (NS/TS), 312/681-7783       created: 88.07.19

   function:
    This file has common declarations for main module QueuExam.  The
    declarations here are shared by other, externally-compiled modules.

   history:
    88.07.19  1.0a  initial release.
*)

DEFINITION MODULE QueData;

FROM  QueueADT  IMPORT  (*TYPE*)  Queues;

CONST
  MaxQueues  = 10;     (* maximum number of queues that may be allocated *)
  MaxServers = 5;      (* maximum number of servers PER QUEUE *)

TYPE
  ServerListIndices = [ 1 .. MaxServers ];
  ServerNumbers     = [ 0 .. MaxServers ];
  QueueListIndices  = [ 1 .. MaxQueues ];

  ServiceFunctions  = ( Exponential, Normal, Lognormal );
  ProcessTimes      = CARDINAL;

  QueueEntryData =
    RECORD
      StartTime:   ProcessTimes;
      ServiceTime: ProcessTimes;
    END;   (* QueueEntryData *)

  QueueInfo =
    RECORD
      theQueue:      Queues;        (* the actual queue (abstract type) *)
      CurrentSize:   CARDINAL;      (* length of the queue *)

      TotalWait:     LONGCARD;      (* total of customer delays in queue *)

      ServerCount:   ServerListIndices;
      ServiceFcn:    ServiceFunctions;
      ServiceTimeEV,
      ServiceParm1,                 (* parameters to the service time ... *)
      ServiceParm2:  REAL;          (*   interval probability distribution *)

      SinkOutputTo:  QueueListIndices;
      ExternalInput: BOOLEAN;
    END;   (* QueueInfo *)

  ServerInfo =
    RECORD
      TotIdleTime: ProcessTimes;  (* total time this server was idle *)
      CustomerCnt: CARDINAL;      (* number of customers server processed *)

      IdleNow:     BOOLEAN;       (* true, if not currently serving *)
      myCustomer:  QueueEntryData;
      IdleSince:   ProcessTimes;
    END;   (* ServerInfo *)

  QueueLists        = ARRAY  QueueListIndices  OF QueueInfo;
  ServerLists       = ARRAY  QueueListIndices, ServerListIndices  OF ServerInfo;

END  QueData.
