Пример #1
0
 public region(string _name, string _prefet, Commune _cheflieu)
 {
     this.name     = _name;
     this.prefet   = _prefet;
     this.chefLieu = _cheflieu;
     this.myCommunes.Add(_cheflieu);
 }
Пример #2
0
 public region(string _name, string _prefet, int nofcommune)
 {
     this.name   = _name;
     this.prefet = _prefet;
     for (int _ = 0; _ <= nofcommune; _++)
     {
         myCommunes.Add(new Commune());
     }
     this.chefLieu = myCommunes[0];
 }
Пример #3
0
 public region(string _name, string _prefet, Commune _cheflieu, List <Commune> liste)
 {
     this.name       = _name;
     this.prefet     = _prefet;
     this.chefLieu   = _cheflieu;
     this.myCommunes = liste;
     if (!this.appartenance(this.chefLieu))
     {
         this.myCommunes.Add(this.chefLieu);
     }
 }
Пример #4
0
        public bool appartenance(Commune other)
        {
            bool res = false;

            for (int i = 0; i < this.myCommunes.Count; i++)
            {
                if (this.myCommunes[i].equals(other))
                {
                    res = true;
                    break;
                }
            }
            return(res);
        }
Пример #5
0
        static void Main(string[] args)
        {
            Commune paris = new Commune("Paris", 75, "FRance", 2200000, "Hidalgo");
            Commune rouen = new Commune("rouen", 76, "FRance", 111000, "Robert");

            paris.Nhabitant = 2220000;
            string s = paris.tostring();
            bool   b = paris.equals(rouen);

            Console.WriteLine(s);
            Console.ReadLine();
            Console.Clear();
            Commune marly       = new Commune("Marly");
            region  IledeFrance = new region("Ile de FRance", "prefet", new Commune("Paris"));

            IledeFrance.Add(new Commune("VErsaille"));
            IledeFrance.Add(marly);
            Console.WriteLine(IledeFrance.appartenance(new Commune()));
            Console.WriteLine(IledeFrance.appartenance(marly));
            Console.ReadLine();
            IledeFrance.disp();
            Console.ReadLine();
            Console.Clear();
            IledeFrance.alphasort();
            IledeFrance.disp();
            Console.ReadLine();
            Console.Clear();
            Console.WriteLine(IledeFrance.tostring());
            Console.WriteLine(IledeFrance.popTotal());
            Console.ReadLine();
            Console.Clear();
            region megapole = new region("big", "unprefet", 100);

            megapole.disp();
            Console.ReadLine();
            Console.Clear();
            megapole.alphasort();
            megapole.disp();
            Console.ReadLine();
        }
Пример #6
0
 public void Add(Commune acomm)
 {
     this.myCommunes.Add(acomm);
 }
Пример #7
0
 public static bool equalstatic(Commune A, Commune B)
 {
     return(A.equals(B));
 }
Пример #8
0
 public bool equals(Commune other)
 {
     return(this.nhabitant == other.nhabitant);
 }