@@ -243,7 +243,7 @@ void SMPLSwithEvents::saveDeterminizedIOAtoFile(const MPString &file) {
243
243
outfile << " ioautomaton statespace{ \r\n " ;
244
244
const auto &I = this ->ioa ->getInitialStates ();
245
245
246
- const auto &finalStates = dynamic_cast < const IOASetOfStateRefs &>( this ->ioa ->getFinalStates () );
246
+ const auto &finalStates = this ->ioa ->getFinalStates ();
247
247
248
248
MPString errMsg = " " ;
249
249
auto i = I.begin ();
@@ -269,15 +269,15 @@ bool SMPLSwithEvents::isConsistent() {
269
269
}
270
270
EventList eventList;
271
271
272
- const auto &I = dynamic_cast < const IOASetOfStates &>( this ->ioa ->getInitialStates () );
272
+ const auto &I = this ->ioa ->getInitialStates ();
273
273
274
- const auto &finalStates = dynamic_cast < const IOASetOfStates &>( this ->ioa ->getFinalStates () );
274
+ const auto &finalStates = this ->ioa ->getFinalStates ();
275
275
276
276
std::map<IOAStateRef, EventList> visited;
277
277
MPString errMsg = " " ;
278
278
for (const auto &i : I) {
279
279
isConsistentUtil (
280
- ( dynamic_cast <IOAState &>(*(i. second )) ), eventList, finalStates, errMsg, visited);
280
+ * dynamic_cast <IOAStateRef>(i ), eventList, finalStates, errMsg, visited);
281
281
}
282
282
283
283
if (!errMsg.empty ()) {
@@ -302,17 +302,20 @@ std::shared_ptr<MaxPlusAutomaton> SMPLSwithEvents::convertToMaxPlusAutomaton() {
302
302
// search
303
303
const auto &I = dynamic_cast <const IOASetOfStates &>(this ->ioa ->getStates ());
304
304
for (const auto &i : I) {
305
- this ->elsFSM .addState (dynamic_cast <ELSState &>(*(i.second )).getLabel ());
305
+ this ->elsFSM .addState (dynamic_cast <IOAState &>(*(i.second )).getLabel ());
306
306
}
307
307
308
- const auto &I2 = dynamic_cast < const IOASetOfStates &>( this ->ioa ->getInitialStates () );
308
+ const auto &I2 = this ->ioa ->getInitialStates ();
309
309
for (const auto &i : I2) {
310
- prepareMatrices ((dynamic_cast <IOAState &>(*(i.second ))), eventList, visitedEdges);
311
- this ->elsFSM .addInitialState ((dynamic_cast <ELSState &>(*(i.second ))));
310
+ auto s = dynamic_cast <IOAStateRef>(i);
311
+ prepareMatrices (*s, eventList, visitedEdges);
312
+ auto sr = this ->elsFSM .getStateLabeled (s->getLabel ());
313
+ this ->elsFSM .addInitialState (*sr);
312
314
}
313
- const auto &I3 = dynamic_cast < const IOASetOfStates &>( this ->ioa ->getFinalStates () );
315
+ const auto &I3 = this ->ioa ->getFinalStates ();
314
316
for (const auto &i : I3) {
315
- this ->elsFSM .addFinalState ((dynamic_cast <ELSState &>(*(i.second ))));
317
+ auto s = dynamic_cast <IOAStateRef>(i);
318
+ this ->elsFSM .addFinalState (*this ->elsFSM .getStateLabeled (s->getLabel ()));
316
319
}
317
320
return SMPLS::convertToMaxPlusAutomaton ();
318
321
}
@@ -369,7 +372,7 @@ Event SMPLSwithEvents::findEventByMode(const Mode &mode) const {
369
372
void SMPLSwithEvents::prepareMatrices (const IOAState &s,
370
373
std::multiset<Event> &eventList,
371
374
IOASetOfEdgeRefs &visitedEdges) {
372
- const auto &adj = dynamic_cast < const IOASetOfEdgeRefs &>( s.getOutgoingEdges () );
375
+ const auto &adj = s.getOutgoingEdges ();
373
376
for (const auto *i : adj) {
374
377
const auto *e = dynamic_cast <IOAEdgeRef>(i);
375
378
if (visitedEdges.count (e) > 0 ) {
@@ -551,7 +554,7 @@ SMPLSwithEvents::findDissectedModeMatrix(const MPString &sName) {
551
554
*/
552
555
void SMPLSwithEvents::isConsistentUtil (const IOAState &s,
553
556
EventList &eventList,
554
- const IOASetOfStates &finalStates,
557
+ const FSM::Abstract::SetOfStateRefs &finalStates,
555
558
MPString &errMsg,
556
559
std::map<IOAStateRef, EventList> &visited) {
557
560
auto it = visited.find (&s);
@@ -567,15 +570,15 @@ void SMPLSwithEvents::isConsistentUtil(const IOAState &s,
567
570
}
568
571
visited.emplace (&s, eventList);
569
572
570
- if (finalStates.count (s. getLabel () ) > 0 ) {
573
+ if (finalStates.count (&s ) > 0 ) {
571
574
if (!eventList.empty ()) {
572
575
errMsg = " Event " + (*eventList.begin ())
573
576
+ " has not been processed by the end of the word.\r\n " ;
574
577
return ;
575
578
}
576
579
} else // If current state is not final
577
580
{
578
- const auto &adj = dynamic_cast < const IOASetOfEdgeRefs &>( s.getOutgoingEdges () );
581
+ const auto &adj = s.getOutgoingEdges ();
579
582
for (const auto *i : adj) {
580
583
// make a copy so that child node can not modify the parent nodes list
581
584
// only adds and removes and passes it to its children
@@ -637,7 +640,7 @@ void SMPLSwithEvents::isConsistentUtil(const IOAState &s,
637
640
*/
638
641
void SMPLSwithEvents::determinizeUtil (const IOAState &s,
639
642
IOASetOfStateRefs &visited,
640
- const IOASetOfStateRefs &finalStates,
643
+ const FSM::Abstract::SetOfStateRefs &finalStates,
641
644
MPString &errMsg,
642
645
std::ofstream &outfile) {
643
646
/* *
0 commit comments