Ejemplo n.º 1
0
 public void Reset()
 {
     alphaID = ""; ;
     index = -1;
     numActions = 0;
     numIndexes = 0;
     next = null;
 }
Ejemplo n.º 2
0
 public void CopyDataElement(string inAlphaID, int inIndex, int count)
 {
     alphaID = inAlphaID;
     index = inIndex;
     if (count != 0)
     {
         numActions = count;
         numIndexes = 1;
     }
     next = null;
 }
Ejemplo n.º 3
0
 public void ResetNextID()
 {
     m_nextID=-1; // since incremented first
     m_nextIndexData = null;
 }
Ejemplo n.º 4
0
        public bool GetNextID(ref int index, ref string alphaID, ref int numActions, ref int numIndexes)
        {
            bool bIsAnother = false; // Changed to true if  exists

            // If nextIndex is still pointing in the link list, use it
            if (m_nextIndexData != null)
            {
                index = m_nextIndexData.index;
                alphaID = m_nextIndexData.alphaID;
                numActions = m_nextIndexData.numActions;
                numIndexes = m_nextIndexData.numIndexes;
                m_nextIndexData = m_nextIndexData.next;
                return true;
            }

            // When nothing linked, go to next element with something
            while (++m_nextID < m_numHashElements)
            {
                if ( m_index[m_nextID].index < 0) continue;
                index = m_index[m_nextID].index;
                alphaID = m_index[m_nextID].alphaID;
                numActions = m_index[m_nextID].numActions;
                numIndexes = m_index[m_nextID].numIndexes;
                m_nextIndexData = m_index[m_nextID].next; // if null, will go to nextID, if not, will use above
                bIsAnother = true;
                break;
            }

            return bIsAnother;
        }
Ejemplo n.º 5
0
        public void GetIndex(string alphaID, ref IndexData pIndex)
        {
            uint ID;

            ID = hash(ref alphaID);
            pIndex = m_index[ID];
            do
            {
                if ( pIndex.index >= 0 && CompareNoCase(pIndex.alphaID, alphaID) )
                    return;
                else
                    pIndex = pIndex.next;
            } while (pIndex != null);

            pIndex = null;
            return;
        }
Ejemplo n.º 6
0
        public int AllocIndex(int numObjects)
        {
            if (numObjects > MaxHashElements)
                m_numHashElements = MaxHashElements * 10;
            else if (numObjects > 0)
                m_numHashElements = (uint) numObjects * 10;
            else
                m_numHashElements = NumHashElements;

            m_index = new IndexData[m_numHashElements];
            for (int i = 0; i < m_numHashElements; i++)
                m_index[i] = new IndexData(); // Implicitly resets variables

            // Initialize Variable
            m_numCollisions = 0;
            m_indexPos = 0;
            m_maxActions = 0;
            m_maxIndexes = 0;
            m_lookup = null;
            ResetNextID();
            ResetNextIndex();
            ResetIndex();

            // isAllocated
            isAllocated = true;

            return 0;
        }