Exemplo n.º 1
0
        public Ilan GetIsIlani(int key)
        {
            int hash = (key % TABLE_SIZE);

            if (table[hash] == null)
            {
                return(null);
            }
            else
            {
                HashChainEntry entry = table[hash];
                while (entry != null && entry.Anahtar != key)
                {
                    entry = entry.Next;
                }
                if (entry == null)
                {
                    return(null);
                }
                else
                {
                    return((Ilan)entry.Deger);
                }
            }
        }
Exemplo n.º 2
0
        public HashChainEntry GetIsIlaniNextDegilAmaKendisi(int ilanNo)
        {
            int hash = (ilanNo % TABLE_SIZE);

            if (table[hash] == null)
            {
                return(null);
            }
            else
            {
                HashChainEntry entry = table[hash];
                while (entry != null && entry.Anahtar != ilanNo)
                {
                    entry = entry.Next;
                }
                if (entry == null)
                {
                    return(null);
                }
                else
                {
                    nextleriListele(entry);
                    return(entry);
                }
            }
        }
Exemplo n.º 3
0
 public void nextleriListele(HashChainEntry entry)
 {
     while (entry.next != null)
     {
         entry = entry.Next;
         nextVarsaOnunIcındekiIlanlar.Add(entry);
     }
 }
Exemplo n.º 4
0
 public Ilan GetIsIlaniForEditingAndListing(int index)
 {
     if (table[index] == null)
     {
         return(null);
     }
     else
     {
         HashChainEntry entry = table[index];
         return((Ilan)entry.Deger);
     }
 }
Exemplo n.º 5
0
        public bool AddIsIlani(int key, object value, Sirket sirket)
        {
            int    hash       = (key % TABLE_SIZE);
            string durum      = "Aktif";
            bool   basarilimi = false;

            if (table[hash] == null)
            {
                table[hash] = new HashChainEntry(key, value, durum, sirket);
                basarilimi  = true;
                return(basarilimi);
            }
            else
            {
                HashChainEntry entry = table[hash];
                if (entry.Durum == "İlana Erişilemiyor")
                {
                    entry.Deger   = value;
                    entry.Anahtar = key;
                    entry.Durum   = "Aktif";
                    basarilimi    = true;
                    return(basarilimi);
                }
                while (entry.Next != null && entry.Anahtar != key)
                {
                    entry = entry.Next;
                }
                if (entry.Anahtar == key)
                {
                    if (entry.Durum == "Aktif")
                    {
                        basarilimi = false;
                        return(basarilimi);
                    }
                    entry.Deger = value;
                    entry.Durum = "Aktif";
                    basarilimi  = true;
                    return(basarilimi);
                }
                else
                {
                    entry.Next = new HashChainEntry(key, value, durum, sirket);
                    basarilimi = true;
                    return(basarilimi);
                }
            }
        }