public Personel GetPersonel(int key)
        {
            int hash = (key % TABLE_SIZE);

            if (table[hash] == null)
            {
                return(null);
            }
            else
            {
                LinkedHashEntry entry = table[hash];
                while (entry != null && entry.Anahtar != key)
                {
                    entry = entry.Next;
                }
                if (entry == null)
                {
                    return(null);
                }
                else
                {
                    return((Personel)entry.Deger);
                }
            }
        }
Beispiel #2
0
 public LinkedHashEntry(string ıl, string ılce, object deger)
 {
     Anahtar1   = ıl;
     Anahtar2   = ılce;
     this.deger = deger;
     this.Next  = null;
 }
        public void AddPersonel(int key, object value)
        {
            int hash = (key % TABLE_SIZE);

            if (table[hash] == null)
            {
                table[hash] = new LinkedHashEntry(key, value);
            }
            else
            {
                LinkedHashEntry entry = table[hash];
                while (entry.Next != null && entry.Anahtar != key)
                {
                    entry = entry.Next;
                }
                if (entry.Anahtar == key)
                {
                    entry.Deger = value;
                }
                else
                {
                    entry.Next = new LinkedHashEntry(key, value);
                }
            }
        }
        private Otel[] ile_gore(string il)
        {
            Otel[] otel      = new Otel[0];
            int    hash1     = SifreOlustur(il) % Iller;
            int    sayac     = 0;
            int    nulldeger = 0;

            for (int i = 0; i < Ilceler; i++)
            {
                if (table[hash1, i] == null)
                {
                    continue;
                }
                else
                {
                    LinkedHashEntry entry = table[hash1, i];
                    while (entry != null && entry.Anahtar1 == il)
                    {
                        nulldeger++;
                        Array.Resize(ref otel, otel.Length + 1);
                        otel[sayac++] = (Otel)entry.deger;
                        entry         = entry.Next;
                    }
                }
            }
            if (nulldeger == 0)
            {
                return(null);
            }
            else
            {
                return(otel);
            }
        }
        public void OtelEkle(string ıl, string ılce, object value)
        {
            int hash1 = SifreOlustur(ıl) % Iller;
            int has2  = (SifreOlustur(ılce) + hash1) % Ilceler;

            if (table[hash1, has2] == null)
            {
                table[hash1, has2] = new LinkedHashEntry(ıl, ılce, value);
            }
            else
            {
                LinkedHashEntry entry = table[hash1, has2];
                while (entry.Next != null)//&& entry.Anahtar1 != ıl&&entry.Anahtar2!=ılce
                {
                    entry = entry.Next;
                }
                entry.Next = new LinkedHashEntry(ıl, ılce, value);
            }
        }
        private Otel[] il_ve_ilceye_gore(string il, string ilce)
        {
            int hash1 = SifreOlustur(il) % Iller;
            int hash2 = (SifreOlustur(ilce) + hash1) % Ilceler;

            if (table[hash1, hash2] == null)
            {
                return(null);
            }
            else
            {
                Otel[]          otel  = new Otel[0];
                int             sayac = 0;
                LinkedHashEntry entry = table[hash1, hash2];
                while (entry != null && entry.Anahtar1 == il && entry.Anahtar2 == ilce)
                {
                    Array.Resize(ref otel, otel.Length + 1);
                    otel[sayac++] = (Otel)entry.deger;
                    entry         = entry.Next;
                }

                return(otel);
            }
        }
Beispiel #7
0
 public LinkedHashEntry(int anahtar, object deger)
 {
     this.anahtar = anahtar;
     this.deger   = deger;
     this.next    = null;
 }