Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

void State::epsilonClosure (  )  [private]

Calculate the epsilon closure over the current state, replacing its content.

Definition at line 187 of file State.C.

References Pool< T >::get(), pool, and state.

Referenced by init(), and step().

{
  list<multimap<Node *, vector<unsigned short> *>::iterator> alive;
  
  for(multimap<Node *, vector<unsigned short> *>::iterator s_it = state.begin(),
                                                           s_limit = state.end(); 
      s_it != s_limit; s_it++)
  {
    alive.push_back(s_it);
  }

  while(alive.size() != 0)
  {
    list<multimap<Node *, vector<unsigned short> *>::iterator>::iterator it = alive.begin();
    map<unsigned short, Dest>::iterator it2;
    it2 = (*it)->first->transitions.find(0);
    
    if(it2 != (*it)->first->transitions.end())
    {
      for(int i = 0 ; i != it2->second.size; i++)
      {
        vector<unsigned short> *tmp = pool.get();
        *tmp = *((*it)->second);
        if(it2->second.out_tag[i] != 0)
        {
        tmp->push_back(it2->second.out_tag[i]);
        }
        alive.push_back(state.insert(pair<Node *, vector<unsigned short> *>(it2->second.dest[i], tmp)));
      }
    }
    alive.erase(it);
  }
}


Generated by  Doxygen 1.6.0   Back to index