コード例 #1
0
ファイル: Index.cs プロジェクト: prajapatichintan/Integration
 public void Reset()
 {
     alphaID = ""; ;
     index = -1;
     numActions = 0;
     numIndexes = 0;
     next = null;
 }
コード例 #2
0
ファイル: Index.cs プロジェクト: prajapatichintan/Integration
 public void CopyDataElement(string inAlphaID, int inIndex, int count)
 {
     alphaID = inAlphaID;
     index = inIndex;
     if (count != 0)
     {
         numActions = count;
         numIndexes = 1;
     }
     next = null;
 }
コード例 #3
0
ファイル: Index.cs プロジェクト: prajapatichintan/Integration
 public void ResetNextID()
 {
     m_nextID=-1; // since incremented first
     m_nextIndexData = null;
 }
コード例 #4
0
ファイル: Index.cs プロジェクト: prajapatichintan/Integration
        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;
        }
コード例 #5
0
ファイル: Index.cs プロジェクト: prajapatichintan/Integration
        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;
        }
コード例 #6
0
ファイル: Index.cs プロジェクト: prajapatichintan/Integration
        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;
        }