/// <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; }
} // end of FindDfaStateByEclosure method public Set GetEclosureByDfaState(State state) { DfaStateRecord dsr = (DfaStateRecord)m_hashStateTable[state]; if (dsr != null) { return(dsr.SetEclosure); } return(null); }
/// <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
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); }
public void Mark(State stateT) { DfaStateRecord stateRecord = (DfaStateRecord)m_hashStateTable[stateT]; stateRecord.Marked = true; }