예제 #1
0
 public PlayerHash()
 {
     // Referenced classes of package net.minecraft.src:
     //            PlayerHashEntry
     capacity  = 12;
     hashArray = new net.minecraft.src.PlayerHashEntry[16];
 }
예제 #2
0
        internal net.minecraft.src.PlayerHashEntry RemoveKey(long l)
        {
            int i = GetHashedKey(l);
            int j = GetHashIndex(i, hashArray.Length);

            net.minecraft.src.PlayerHashEntry playerhashentry = hashArray[j];
            net.minecraft.src.PlayerHashEntry playerhashentry1;
            net.minecraft.src.PlayerHashEntry playerhashentry2;
            for (playerhashentry1 = playerhashentry; playerhashentry1 != null; playerhashentry1
                     = playerhashentry2)
            {
                playerhashentry2 = playerhashentry1.nextEntry;
                if (playerhashentry1.key == l)
                {
                    field_950_e++;
                    numHashElements--;
                    if (playerhashentry == playerhashentry1)
                    {
                        hashArray[j] = playerhashentry2;
                    }
                    else
                    {
                        playerhashentry.nextEntry = playerhashentry2;
                    }
                    return(playerhashentry1);
                }
                playerhashentry = playerhashentry1;
            }
            return(playerhashentry1);
        }
예제 #3
0
 private void CreateKey(int i, long l, object obj, int j)
 {
     net.minecraft.src.PlayerHashEntry playerhashentry = hashArray[j];
     hashArray[j] = new net.minecraft.src.PlayerHashEntry(i, l, obj, playerhashentry);
     if (numHashElements++ >= capacity)
     {
         ResizeTable(2 * hashArray.Length);
     }
 }
예제 #4
0
 internal PlayerHashEntry(int i, long l, object obj, net.minecraft.src.PlayerHashEntry
                          playerhashentry)
 {
     // Referenced classes of package net.minecraft.src:
     //            PlayerHash
     value        = obj;
     nextEntry    = playerhashentry;
     key          = l;
     field_1026_d = i;
 }
예제 #5
0
        public virtual object GetValueByKey(long l)
        {
            int i = GetHashedKey(l);

            for (net.minecraft.src.PlayerHashEntry playerhashentry = hashArray[GetHashIndex(i
                                                                                            , hashArray.Length)]; playerhashentry != null; playerhashentry = playerhashentry
                                                                                                                                                             .nextEntry)
            {
                if (playerhashentry.key == l)
                {
                    return(playerhashentry.value);
                }
            }
            return(null);
        }
예제 #6
0
        public virtual void Add(long l, object obj)
        {
            int i = GetHashedKey(l);
            int j = GetHashIndex(i, hashArray.Length);

            for (net.minecraft.src.PlayerHashEntry playerhashentry = hashArray[j]; playerhashentry
                 != null; playerhashentry = playerhashentry.nextEntry)
            {
                if (playerhashentry.key == l)
                {
                    playerhashentry.value = obj;
                }
            }
            field_950_e++;
            CreateKey(i, l, obj, j);
        }
예제 #7
0
        private void ResizeTable(int i)
        {
            net.minecraft.src.PlayerHashEntry[] aplayerhashentry = hashArray;
            int j = aplayerhashentry.Length;

            if (j == 0x40000000)
            {
                capacity = 0x7fffffff;
                return;
            }
            else
            {
                net.minecraft.src.PlayerHashEntry[] aplayerhashentry1 = new net.minecraft.src.PlayerHashEntry
                                                                        [i];
                CopyHashTableTo(aplayerhashentry1);
                hashArray = aplayerhashentry1;
                capacity  = (int)((float)i * percentUsable);
                return;
            }
        }
예제 #8
0
        public sealed override bool Equals(object obj)
        {
            if (!(obj is net.minecraft.src.PlayerHashEntry))
            {
                return(false);
            }
            net.minecraft.src.PlayerHashEntry playerhashentry = (net.minecraft.src.PlayerHashEntry
                                                                 )obj;
            long long1 = Func_736_a();
            long long2 = playerhashentry.Func_736_a();

            if (long1 == long2 || long1 != null && long1.Equals(long2))
            {
                object obj1 = Func_735_b();
                object obj2 = playerhashentry.Func_735_b();
                if (obj1 == obj2 || obj1 != null && obj1.Equals(obj2))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #9
0
        private void CopyHashTableTo(net.minecraft.src.PlayerHashEntry[] aplayerhashentry
                                     )
        {
            net.minecraft.src.PlayerHashEntry[] aplayerhashentry1 = hashArray;
            int i = aplayerhashentry.Length;

            for (int j = 0; j < aplayerhashentry1.Length; j++)
            {
                net.minecraft.src.PlayerHashEntry playerhashentry = aplayerhashentry1[j];
                if (playerhashentry == null)
                {
                    continue;
                }
                aplayerhashentry1[j] = null;
                do
                {
                    net.minecraft.src.PlayerHashEntry playerhashentry1 = playerhashentry.nextEntry;
                    int k = GetHashIndex(playerhashentry.field_1026_d, i);
                    playerhashentry.nextEntry = aplayerhashentry[k];
                    aplayerhashentry[k]       = playerhashentry;
                    playerhashentry           = playerhashentry1;
                }while (playerhashentry != null);
            }
        }
예제 #10
0
 public virtual object Remove(long l)
 {
     net.minecraft.src.PlayerHashEntry playerhashentry = RemoveKey(l);
     return(playerhashentry != null ? playerhashentry.value : null);
 }