Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void RemoveAllPags(Queue<Queue<Milk>> q,int Day,int Month, int Year)
- {
- Queue<Queue<Milk>> q2 = new Queue<Queue<Milk>>();
- while (!q.IsEmpty())
- {
- Queue<Milk> x = q.Remove();
- RemovePag(x,Day,Month,Year);
- q2.Insert(x);
- }
- while (!q2.IsEmpty())
- q.Insert(q2.Remove());
- }
- public static void ManageMadafs(Queue<Queue<Milk>> q)
- {
- Queue<Queue<Milk>> q2 = new Queue<Queue<Milk>>();
- while (!q.IsEmpty())
- {
- Queue<Milk> x = q.Remove();
- ChangeMadaf(x);
- q2.Insert(x);
- }
- while (!q2.IsEmpty())
- q.Insert(q2.Remove());
- }
- public static void ChangeMadaf(Queue<Milk> q)
- {
- Queue<Milk> q2 = new Queue<Milk>();
- while (!q.IsEmpty())
- {
- q2.Insert(RemoveLatest(q));
- }
- while (!q2.IsEmpty())
- q.Insert(q2.Remove());
- }
- public static Milk RemoveLatest(Queue<Milk> q)
- {
- Queue<Milk> q2 = new Queue<Milk>();
- Milk min = q.Remove();
- q2.Insert(min);
- while (!q.IsEmpty())
- {
- Milk check = q.Remove();
- if (check.Day > min.Day && check.Month == min.Month && check.Year == min.Year)
- {
- q2.Insert(min);
- min = check;
- }
- else if (check.Month > min.Month && check.Year == min.Year)
- {
- q2.Insert(min);
- min = check;
- }
- else if (check.Year > min.Year)
- {
- q2.Insert(min);
- min = check;
- }
- else q2.Insert(check);
- }
- while (!q2.IsEmpty())
- {
- q.Insert(q2.Remove());
- }
- return min;
- }
- public static void RemovePag(Queue<Milk> q, int Day,int Month, int Year)
- {
- Queue<Milk> q2 = new Queue<Milk>();
- while (!q.IsEmpty())
- {
- Milk x = q.Remove();
- if (x.Day < Day && x.Month == Month && x.Year == Year)
- q2.Insert(x);
- else if (x.Month < Month && x.Year == Year)
- q2.Insert(x);
- else if (x.Year < Year)
- q2.Insert(x);
- }
- while (!q2.IsEmpty())
- q.Insert(q2.Remove());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement