コード例 #1
0
        public SystemExploitation Clone()
        {
            SystemExploitation tmp = (SystemExploitation)this.MemberwiseClone();

            tmp.fileLru = new Queue <int>(this.fileLru);
            tmp.fifo    = new Queue <int>(this.fifo);
            tmp.aging   = new List <uint>(aging);

            return(tmp);
        }
コード例 #2
0
 private void choixAlgorithme_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ram = new RamVirtuelle(5);
     systemExploitation = new SystemExploitation();
     diskDur            = new DiskDur(5);
     tablePages         = new List <EntreeTablePage>();
     majTablePage();
     lancer.IsEnabled  = true;
     sauvSuite         = suiteReferences.Text;
     suivant.IsEnabled = true;
     iteration         = 0;
     systemExploitation.creationTablePages(tablePages, 2 * nbPages, ram, diskDur);
     aux.Children.Clear();
     canvas1.Children.Clear();
     afficherRam(ram);
 }
コード例 #3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (sequence.Count != 0)
            {
                SystemExploitation tmpOs = new SystemExploitation();
                tmpOs = systemExploitation.Clone();
                List <object> tmp = sequence.Pop();
                systemExploitation = (SystemExploitation)tmp[0];
                ram        = (RamVirtuelle)tmp[1];
                diskDur    = (DiskDur)tmp[2];
                tablePages = (List <EntreeTablePage>)tmp[3];
                requete    = (List <String>)tmp[4];
                sauvSuite  = (String)tmp[5];
                afficherRam(ram);
                champAdressePhysique.Text = "";
                champAux.Text             = "";
                champRam.Text             = "";
                champTPages.Text          = "";
                demande.Text     = "Demande de l'adresse virtuelle: ";
                deroulement.Text = "Nombre de defauts de page: " + systemExploitation.getDefautDePage().ToString();
                switch (choixAlgorithme.SelectedIndex)
                {
                case 0:
                    suppFileLru();
                    if (tmpOs.fileLru.Count == systemExploitation.fileLru.Count && tmpOs.fileLru.Peek() != systemExploitation.fileLru.Peek())
                    {
                        double  y       = 0;
                        Ellipse ellipse = new Ellipse()
                        {
                            Height = 30, Width = 30, Fill = Brushes.Cyan
                        };

                        TextBlock num = new TextBlock
                        {
                            Text = tablePages.FindIndex(h => h.getPageCorrespandante() == systemExploitation.fileLru.Peek() && h.getDisponible() == true).ToString(), FontSize = 14
                        };
                        double x = (aux.Children.Count / 2) * (ellipse.Width + 10);
                        aux.Children.Insert(0, ellipse);
                        Canvas.SetLeft(ellipse, x);
                        Canvas.SetTop(ellipse, y);
                        aux.Children.Insert(1, num);
                        Canvas.SetLeft(num, x + ellipse.Height / 2 - num.FontSize / 2 + 1);
                        Canvas.SetTop(num, y + ellipse.Width / 2 - num.FontSize / 2);
                    }
                    break;

                case 1:
                    foreach (EntreeTablePage page in tablePages)
                    {
                    }
                    //suppFileFifo();
                    //if (tmpOs.fifo.Count == systemExploitation.fifo.Count && tmpOs.fifo.Peek() != systemExploitation.fifo.Peek())
                    //{
                    //    double y = 0;
                    //    Ellipse ellipse = new Ellipse()
                    //    { Height = 30, Width = 30, Fill = Brushes.Cyan };

                    //    TextBlock num = new TextBlock
                    //    { Text = tablePages.FindIndex(h => h.getPageCorrespandante() == systemExploitation.fifo.Peek() && h.getDisponible() == true).ToString(), FontSize = 14 };
                    //    double x =  (aux.Children.Count / 2) * (ellipse.Width + 10);
                    //    aux.Children.Insert(0, ellipse);
                    //    Canvas.SetLeft(ellipse, x);
                    //    Canvas.SetTop(ellipse, y);
                    //    aux.Children.Insert(1, num);
                    //    Canvas.SetLeft(num, x + ellipse.Height / 2 - num.FontSize / 2 + 1);
                    //    Canvas.SetTop(num, y + ellipse.Width / 2 - num.FontSize / 2);
                    //}
                    break;

                case 2:
                    affichLfu();
                    break;

                case 3:
                    affichMatriceAging();
                    break;
                }
                iteration--;
                lancer.IsEnabled  = true;
                suivant.IsEnabled = true;
                majTablePage();
                if (iteration == 0)
                {
                    precedent.IsEnabled = false;
                }
            }
        }