-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathState.c
More file actions
46 lines (39 loc) · 1 KB
/
State.c
File metadata and controls
46 lines (39 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "State.h"
#include "ReazienerUtils.h"
State::State()
{
m_bMarked = FALSE;
m_iPartitionNum = 0;
m_pRep = NULL;
m_iName = 0;
}
// add an edge to from current state to s on transition
void State::addTransition(void* pTransition, State* pS)
{
if( pTransition == NULL || pS == NULL )
assertFALSE("NullPointerException");
Transition* pT = new Transition(pTransition, pS);
m_setTransitions.insert(pT);
}
// add an edge to from current state to s on epsilon transition
void State::addTransition(State* pS)
{
if( pS == NULL )
assertFALSE("NullPointerException");
Transition* pT = new Transition(pS);
m_setTransitions.insert(pT);
}
State* State::dMove(void* pObj)
{
for(TransitionSet::iterator t = m_setTransitions.begin(); t != m_setTransitions.end(); t++ )
{
Transition* pT = (Transition*)*t;
if( pT->hasName(pObj) )
return pT->m_pTo;
}
return NULL;
}
int isEqualState(const State* pState1, const State* pState2)
{
return (pState1->m_iName-pState2->m_iName);
}