Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PROCEDURE (t: Traffic) SortWachtrij();
  2.    
  3.         VAR
  4.             teller1, teller2, teller3: INTEGER;
  5.             tempnode: CircDLL.Node;
  6.             tempplane: CircDLL.Node;
  7.             tempname: StringTypes.SimpleTypeString;
  8.             airport: Airport.Airport;
  9.             airplane: Airplane.Airplane;
  10.                    
  11.     BEGIN
  12.         teller1 := 0;
  13.         NEW(tempnode);
  14.         tempnode^.Init;
  15.         tempnode := t^.Ports^.GetFirstNode();
  16.         NEW(tempplane);
  17.         tempplane^.Init;
  18.         tempplane := t^.Planes^.GetFirstNode();
  19.         IF tempnode IS Airport.Airport THEN
  20.             airport := tempnode(Airport.Airport);
  21.         END;
  22.         IF tempplane IS Airplane.Airplane THEN
  23.             airplane := tempplane(Airplane.Airplane);
  24.         END;
  25.        
  26.         IF (airplane = t^.Planes^.GetLastNode()) & (airplane = t^.Planes^.GetFirstNode()) THEN
  27.                 IF airport^.GetName() = airplane^.GetDepart() THEN
  28.                     airport^.wachtlijst[teller1] := airplane^.GetNumber();
  29.                 END;
  30.         ELSE
  31.             FOR teller3 := 0 TO (t^.Planes^.GetLength() -1) BY 1 DO
  32.                 IF airport^.GetName() = airplane^.GetDepart() THEN
  33.                     airport^.wachtlijst[teller2] := airplane^.GetNumber();  
  34.                     INC(teller2);
  35.                     airplane := airplane^.NextNode^();
  36.                 ELSE
  37.                 airplane := airplane^.NextNode^();
  38.                 END;           
  39.             END;
  40.         END;
  41.             airport := airport^.NextNode^();
  42.             WHILE airport # t^.Ports^.GetFirstNode() DO
  43.                 airplane := t^.Planes^.GetFirstNode^();
  44.                 IF (airplane = t^.Planes^.GetLastNode()) & (airplane = t^.Planes^.GetFirstNode()) THEN
  45.                 IF airport^.GetName() = airplane^.GetDepart() THEN
  46.                     airport^.wachtlijst[teller1] := airplane^.GetNumber();
  47.                 END;
  48.         ELSE
  49.             teller2 := 0;
  50.             FOR teller3 := 0 TO (t^.Planes^.GetLength() -1) BY 1 DO
  51.                 IF airport^.GetName() = airplane^.GetDepart() THEN
  52.                     airport^.wachtlijst[teller2] := airplane^.GetNumber();  
  53.                     INC(teller2);
  54.                     airplane := airplane^.NextNode^();
  55.                 ELSE
  56.                 airplane := airplane^.NextNode^();
  57.                 END;           
  58.             END;
  59.         END;
  60.             airport := airport^.NextNode^();
  61.             END;
  62.         END SortWachtrij;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement