Ejemplo n.º 1
0
        /// <summary>
        /// Simply adds newly created DFA state to the table
        /// </summary>
        /// <param name="stateDfa">the newly created DFA state</param>
        /// <param name="setEclosure">set of Eclosure that was used to create the DFA state</param>
        public void AddDfaState(State stateDfa, Set setEclosure)
        {
            DfaStateRecord stateRecord = new DfaStateRecord();

            stateRecord.SetEclosure = setEclosure;

            m_hashStateTable[stateDfa] = stateRecord;
        }
Ejemplo n.º 2
0
        } // end of FindDfaStateByEclosure method

        public Set GetEclosureByDfaState(State state)
        {
            DfaStateRecord dsr = (DfaStateRecord)m_hashStateTable[state];

            if (dsr != null)
            {
                return(dsr.SetEclosure);
            }
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// finds a DFA state using a set of Eclosure state as search criteria.
        /// because all DFAs are constructed from a set of NFA state
        /// </summary>
        /// <param name="setNfaState">set of Eclosure state as search criteria</param>
        /// <returns>if found, returns the DFA state record, or returns null</returns>
        public State FindDfaStateByEclosure(Set setEclosure)
        {
            DfaStateRecord stateRecord = null;

            foreach (DictionaryEntry de in m_hashStateTable)
            {
                stateRecord = (DfaStateRecord)de.Value;
                if (stateRecord.SetEclosure.IsEqual(setEclosure) == true)
                {
                    return((State)de.Key);
                }
            }
            return(null);
        } // end of FindDfaStateByEclosure method
Ejemplo n.º 4
0
        public State GetNextUnmarkedDfaState()
        {
            DfaStateRecord stateRecord = null;

            foreach (DictionaryEntry de in m_hashStateTable)
            {
                stateRecord = (DfaStateRecord)de.Value;

                if (stateRecord.Marked == false)
                {
                    return((State)de.Key);
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
        public void Mark(State stateT)
        {
            DfaStateRecord stateRecord = (DfaStateRecord)m_hashStateTable[stateT];

            stateRecord.Marked = true;
        }