public void AddDfaState(TransitionState stateDfa, Hashset setEclosure)
        {
            DFAState stateRecord = new DFAState();

            stateRecord.SetEclosure = setEclosure;

            _stateHashTable[stateDfa] = stateRecord;
        }
Exemple #2
0
 public TransitionState GetSingleTransition(string sInputSymbol)
 {
     if (MatchingStateMap.Contains(sInputSymbol) == true)
     {
         Hashset set = MatchingStateMap[sInputSymbol] as Hashset;
         return((TransitionState)set[0]);
     }
     return(null);
 }
Exemple #3
0
 public TransitionState[] GetTransitions(string sInputSymbol)
 {
     if (MatchingStateMap.Contains(sInputSymbol) == true)
     {
         Hashset set = MatchingStateMap[sInputSymbol] as Hashset;
         return((TransitionState[])set.ToArray(typeof(TransitionState)));
     }
     return(null);
 }
        public bool IsEqual(Hashset setValue)
        {
            if (GetCardinality() == setValue.GetCardinality() && IsSubset(setValue))
            {
                return(true);
            }

            return(false);
        }
        public bool IsProperSubset(Hashset setValue)
        {
            if (GetCardinality() > setValue.GetCardinality() && IsSubset(setValue))
            {
                return(true);
            }

            return(false);
        }
 public void Subtract(Hashset setValue)
 {
     foreach (object obj in setValue)
     {
         if (Contains(obj) == true)
         {
             RemoveElement(obj);
         }
     }
 }
 public void Union(Hashset setValue)
 {
     foreach (object obj in setValue)
     {
         if (Contains(obj) == false)
         {
             List.Add(obj);
         }
     }
 }
 public bool IsSubset(Hashset setValue)
 {
     foreach (object obj in setValue)
     {
         if (Contains(obj) == false)
         {
             return(false);
         }
     }
     return(true);
 }
        public Hashset GetAllDfaState()
        {
            Hashset setState = new Hashset();

            foreach (object objKey in _stateHashTable.Keys)
            {
                setState.AddElement(objKey);
            }

            return(setState);
        }
        public TransitionState FindDfaStateByEclosure(Hashset setEclosure)
        {
            DFAState stateRecord;

            foreach (DictionaryEntry de in _stateHashTable)
            {
                stateRecord = de.Value as DFAState;
                if (stateRecord.SetEclosure.IsEqual(setEclosure) == true)
                {
                    return(de.Key as TransitionState);
                }
            }
            return(null);
        }
Exemple #11
0
        public override void Add(object key, object mapTo)
        {
            Hashset set;

            if (base.Contains(key) == true)
            {
                set = base[key] as Hashset;
            }
            else
            {
                set = new Hashset();
            }
            set.AddElement(mapTo);
            base[key] = set;
        }