#include <PathTree.hpp>
Public Methods | |
| void * | operator new (size_t size) |
| void | operator delete (void *ptr) |
| void | PrintPath () |
| char | IsAccepting () |
| FSMManStateItem * | GetFSMStates () |
| void | ComputeInitStateList (unsigned char *isaccepting) |
| void | ComputeNextStateList (TLabelID labelid, unsigned char *isaccepting) |
Public Attributes | |
| PathTreeNode * | parent |
| PathTreeNode * | nextsamehash |
| TLabelID | labelid |
| unsigned char | isaccepting:1 |
| FSMManStateItem * | fsmstatelist |
|
|
Definition at line 82 of file PathTree.cpp. 00085 {
00086 VPathExpr *pathexpr=pathexprman.GetVPathExprs();
00087 FSMManStateItem **statelistref=&fsmstatelist;
00088
00089 *isaccepting=1;
00090
00091 // We consider all path expressions
00092 while(pathexpr!=NULL)
00093 {
00094 #ifdef PROFILE
00095 pathtree.fsmstatecount++;
00096 #endif
00097
00098 // Let's create a new FSM state reference for each FSM
00099 *statelistref=new FSMManStateItem();
00100
00101 (*statelistref)->pathexpr =pathexpr;
00102
00103 #ifndef USE_FORWARD_DATAGUIDE
00104 // We annotate the state with the start state of the reverse FSM
00105 (*statelistref)->curstate =pathexpr->GetReverseFSMStartState();
00106 // We also find (or create) the corresponding root node from the
00107 // path dictionary
00108 (*statelistref)->pathdictnode=pathdict.FindOrCreateRootPath(pathexpr);
00109 #else
00110 (*statelistref)->curstate =pathexpr->GetForwardFSMStartState();
00111 ComputePathDictNode(*statelistref);
00112 #endif
00113
00114 // If one of the FSM states is not accepting, then the *entire*
00115 // dataguide state is not accepting.
00116 if((*statelistref)->curstate->IsAccepting()==0)
00117 *isaccepting=0;
00118
00119 statelistref=&((*statelistref)->next);
00120 pathexpr=pathexpr->GetNext();
00121 }
00122 *statelistref=NULL;
00123 }
|
|
||||||||||||
|
Definition at line 125 of file PathTree.cpp. 00128 {
00129 FSMManStateItem *newstatelist=NULL,**newstatelistref=&fsmstatelist,
00130 *newfsmstate;
00131 FSMState *nextstate;
00132 char overpoundedge;
00133
00134 // Let's find the previous set of FSM states
00135 FSMManStateItem *prevstatelist=parent->fsmstatelist;
00136
00137 *isaccepting=1;
00138
00139 // We conside all FSM states of the parent node
00140 while(prevstatelist!=NULL)
00141 {
00142 // Can we find a successor state over 'labelid'?
00143 nextstate=prevstatelist->curstate->GetNextState(labelid,&overpoundedge);
00144 if(nextstate==NULL)
00145 // There is no following state, i.e. the automaton does not
00146 // accept that word
00147 {
00148 prevstatelist=prevstatelist->next;
00149 continue;
00150 }
00151
00152 #ifdef PROFILE
00153 pathtree.fsmstatecount++;
00154 #endif
00155
00156 newfsmstate=new FSMManStateItem();
00157
00158 newfsmstate->pathexpr =prevstatelist->pathexpr;
00159 newfsmstate->curstate =nextstate;
00160
00161 #ifndef USE_FORWARD_DATAGUIDE
00162 // If we have a pound edge, we need to maintain this information,
00163 // since pound edges must be instantiated to labels
00164 newfsmstate->overpoundedge =(unsigned long)overpoundedge;
00165
00166 // If we have a '#' edge, then we need to go to some child node
00167 // in the path dictionary that is reachable of the labelid
00168 if(overpoundedge)
00169 newfsmstate->pathdictnode=pathdict.FindOrCreatePath(prevstatelist->pathdictnode,labelid);
00170 else
00171 // Otherwise, we stay in the same path dictionary node
00172 newfsmstate->pathdictnode=prevstatelist->pathdictnode;
00173 #else
00174 if(nextstate->IsFinal())
00175 ComputePathDictNode(newfsmstate);
00176 else
00177 newfsmstate->pathdictnode=NULL;
00178 #endif
00179
00180 // If one of the next states is not accepting,
00181 // then the entire state is not accepting
00182 if(nextstate->IsAccepting()==0)
00183 *isaccepting=0;
00184
00185 *newstatelistref=newfsmstate;
00186 newstatelistref=&(newfsmstate->next);
00187
00188 prevstatelist=prevstatelist->next;
00189 }
00190 *newstatelistref=NULL;
00191 }
|
|
|
Definition at line 92 of file PathTree.hpp. 00092 { return fsmstatelist; }
|
|
|
Definition at line 91 of file PathTree.hpp. 00091 { return isaccepting; }
|
|
|
Definition at line 76 of file PathTree.hpp. |
|
|
Definition at line 74 of file PathTree.hpp. 00074 {}
|
|
|
Definition at line 73 of file PathTree.hpp. 00073 { return pathtreemem->GetByteBlock(size); }
|
|
|
Definition at line 66 of file PathTree.hpp. |
|
|
Definition at line 63 of file PathTree.hpp. |
|
|
Definition at line 62 of file PathTree.hpp. Referenced by pathtreemem().
|
|
|
Definition at line 60 of file PathTree.hpp. |
|
|
Definition at line 59 of file PathTree.hpp. Referenced by PrintPath(), and pathtreemem().
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001