Guest User

Untitled

a guest
Feb 21st, 2020
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void RemoveAllPags(Queue<Queue<Milk>> q,int Day,int Month, int Year)
  2. {
  3. Queue<Queue<Milk>> q2 = new Queue<Queue<Milk>>();
  4. while (!q.IsEmpty())
  5. {
  6. Queue<Milk> x = q.Remove();
  7. RemovePag(x,Day,Month,Year);
  8. q2.Insert(x);
  9. }
  10. while (!q2.IsEmpty())
  11. q.Insert(q2.Remove());
  12. }
  13. public static void ManageMadafs(Queue<Queue<Milk>> q)
  14. {
  15. Queue<Queue<Milk>> q2 = new Queue<Queue<Milk>>();
  16. while (!q.IsEmpty())
  17. {
  18. Queue<Milk> x = q.Remove();
  19. ChangeMadaf(x);
  20. q2.Insert(x);
  21. }
  22. while (!q2.IsEmpty())
  23. q.Insert(q2.Remove());
  24. }
  25. public static void ChangeMadaf(Queue<Milk> q)
  26. {
  27. Queue<Milk> q2 = new Queue<Milk>();
  28. while (!q.IsEmpty())
  29. {
  30. q2.Insert(RemoveLatest(q));
  31. }
  32. while (!q2.IsEmpty())
  33. q.Insert(q2.Remove());
  34.  
  35. }
  36. public static Milk RemoveLatest(Queue<Milk> q)
  37. {
  38. Queue<Milk> q2 = new Queue<Milk>();
  39. Milk min = q.Remove();
  40. q2.Insert(min);
  41. while (!q.IsEmpty())
  42. {
  43. Milk check = q.Remove();
  44. if (check.Day > min.Day && check.Month == min.Month && check.Year == min.Year)
  45. {
  46. q2.Insert(min);
  47. min = check;
  48. }
  49. else if (check.Month > min.Month && check.Year == min.Year)
  50. {
  51. q2.Insert(min);
  52. min = check;
  53. }
  54. else if (check.Year > min.Year)
  55. {
  56. q2.Insert(min);
  57. min = check;
  58. }
  59. else q2.Insert(check);
  60. }
  61. while (!q2.IsEmpty())
  62. {
  63. q.Insert(q2.Remove());
  64. }
  65. return min;
  66. }
  67. public static void RemovePag(Queue<Milk> q, int Day,int Month, int Year)
  68. {
  69. Queue<Milk> q2 = new Queue<Milk>();
  70. while (!q.IsEmpty())
  71. {
  72. Milk x = q.Remove();
  73. if (x.Day < Day && x.Month == Month && x.Year == Year)
  74. q2.Insert(x);
  75. else if (x.Month < Month && x.Year == Year)
  76. q2.Insert(x);
  77. else if (x.Year < Year)
  78. q2.Insert(x);
  79. }
  80. while (!q2.IsEmpty())
  81. q.Insert(q2.Remove());
  82. }
RAW Paste Data