Exemple #1
0
        internal net.minecraft.src.MCHashEntry RemoveEntry(int i)
        {
            int j = ComputeHash(i);
            int k = GetSlotIndex(j, slots.Length);

            net.minecraft.src.MCHashEntry mchashentry = slots[k];
            net.minecraft.src.MCHashEntry mchashentry1;
            net.minecraft.src.MCHashEntry mchashentry2;
            for (mchashentry1 = mchashentry; mchashentry1 != null; mchashentry1 = mchashentry2)
            {
                mchashentry2 = mchashentry1.nextEntry;
                if (mchashentry1.hashEntry == i)
                {
                    versionStamp++;
                    count--;
                    if (mchashentry == mchashentry1)
                    {
                        slots[k] = mchashentry2;
                    }
                    else
                    {
                        mchashentry.nextEntry = mchashentry2;
                    }
                    return(mchashentry1);
                }
                mchashentry = mchashentry1;
            }
            return(mchashentry1);
        }
Exemple #2
0
 public MCHash()
 {
     // Referenced classes of package net.minecraft.src:
     //            MCHashEntry
     threshold = 12;
     slots     = new net.minecraft.src.MCHashEntry[16];
 }
Exemple #3
0
 private void Insert(int i, int j, object obj, int k)
 {
     net.minecraft.src.MCHashEntry mchashentry = slots[k];
     slots[k] = new net.minecraft.src.MCHashEntry(i, j, obj, mchashentry);
     if (count++ >= threshold)
     {
         Grow(2 * slots.Length);
     }
 }
Exemple #4
0
 internal MCHashEntry(int i, int j, object obj, net.minecraft.src.MCHashEntry mchashentry
                      )
 {
     // Referenced classes of package net.minecraft.src:
     //            MCHash
     valueEntry = obj;
     nextEntry  = mchashentry;
     hashEntry  = j;
     slotHash   = i;
 }
Exemple #5
0
        internal net.minecraft.src.MCHashEntry LookupEntry(int i)
        {
            int j = ComputeHash(i);

            for (net.minecraft.src.MCHashEntry mchashentry = slots[GetSlotIndex(j, slots.Length
                                                                                )]; mchashentry != null; mchashentry = mchashentry.nextEntry)
            {
                if (mchashentry.hashEntry == i)
                {
                    return(mchashentry);
                }
            }
            return(null);
        }
Exemple #6
0
        public virtual object Lookup(int i)
        {
            int j = ComputeHash(i);

            for (net.minecraft.src.MCHashEntry mchashentry = slots[GetSlotIndex(j, slots.Length
                                                                                )]; mchashentry != null; mchashentry = mchashentry.nextEntry)
            {
                if (mchashentry.hashEntry == i)
                {
                    return(mchashentry.valueEntry);
                }
            }
            return(null);
        }
Exemple #7
0
        public virtual void AddKey(int i, object obj)
        {
            int j = ComputeHash(i);
            int k = GetSlotIndex(j, slots.Length);

            for (net.minecraft.src.MCHashEntry mchashentry = slots[k]; mchashentry != null; mchashentry
                     = mchashentry.nextEntry)
            {
                if (mchashentry.hashEntry == i)
                {
                    mchashentry.valueEntry = obj;
                }
            }
            versionStamp++;
            Insert(j, i, obj, k);
        }
Exemple #8
0
        private void Grow(int i)
        {
            net.minecraft.src.MCHashEntry[] amchashentry = slots;
            int j = amchashentry.Length;

            if (j == 0x40000000)
            {
                threshold = 0x7fffffff;
                return;
            }
            else
            {
                net.minecraft.src.MCHashEntry[] amchashentry1 = new net.minecraft.src.MCHashEntry
                                                                [i];
                CopyTo(amchashentry1);
                slots     = amchashentry1;
                threshold = (int)((float)i * growFactor);
                return;
            }
        }
Exemple #9
0
        public sealed override bool Equals(object obj)
        {
            if (!(obj is net.minecraft.src.MCHashEntry))
            {
                return(false);
            }
            net.minecraft.src.MCHashEntry mchashentry = (net.minecraft.src.MCHashEntry)obj;
            int integer  = GetHash();
            int integer1 = mchashentry.GetHash();

            if (integer == integer1 || integer != null && integer.Equals(integer1))
            {
                object obj1 = GetValue();
                object obj2 = mchashentry.GetValue();
                if (obj1 == obj2 || obj1 != null && obj1.Equals(obj2))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #10
0
        private void CopyTo(net.minecraft.src.MCHashEntry[] amchashentry)
        {
            net.minecraft.src.MCHashEntry[] amchashentry1 = slots;
            int i = amchashentry.Length;

            for (int j = 0; j < amchashentry1.Length; j++)
            {
                net.minecraft.src.MCHashEntry mchashentry = amchashentry1[j];
                if (mchashentry == null)
                {
                    continue;
                }
                amchashentry1[j] = null;
                do
                {
                    net.minecraft.src.MCHashEntry mchashentry1 = mchashentry.nextEntry;
                    int k = GetSlotIndex(mchashentry.slotHash, i);
                    mchashentry.nextEntry = amchashentry[k];
                    amchashentry[k]       = mchashentry;
                    mchashentry           = mchashentry1;
                }while (mchashentry != null);
            }
        }
Exemple #11
0
 public virtual object RemoveObject(int i)
 {
     net.minecraft.src.MCHashEntry mchashentry = RemoveEntry(i);
     return(mchashentry != null ? mchashentry.valueEntry : null);
 }