public void RemoveBilgi(int key)
        {
            int hash = (key % TABLE_SIZE);

            if (table[hash] != null)
            {
                LinkedHashEntry prevEntry = null;
                LinkedHashEntry entry     = table[hash];
                while (entry.Next != null && entry.Anahtar != key)
                {
                    prevEntry = entry;
                    entry     = entry.Next;
                }
                if (entry.Anahtar == key)
                {
                    if (prevEntry == null)
                    {
                        table[hash] = entry.Next;
                    }
                    else
                    {
                        prevEntry.Next = entry.Next;
                    }
                }
            }
        }
        public object GetBilgi(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(entry.Deger);
                }
            }
        }
        public void AddBilgi(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);
                }
            }
        }
Exemple #4
0
 public LinkedHashEntry(int anahtar, object deger)
 {
     this.anahtar = anahtar;
     this.deger   = deger;
     this.next    = null;
 }