| 70 | } |
| 71 | |
| 72 | void Graph::addActionFromState(const StatePtr &node) { |
| 73 | auto nodeActions = node->getActions(); |
| 74 | for (const auto &action: nodeActions) { |
| 75 | auto itervisted = this->_visitedActions.find(action); |
| 76 | bool visitedadd = itervisted != this->_visitedActions.end(); |
| 77 | auto iterunvisited = this->_unvisitedActions.find(action); |
| 78 | bool unvisitedadd = !visitedadd && iterunvisited != this->_unvisitedActions.end(); |
| 79 | if (visitedadd || unvisitedadd) { |
| 80 | action->setId((visitedadd ? (*itervisted)->getIdi() : (*iterunvisited)->getIdi())); |
| 81 | } else { |
| 82 | action->setId((int) this->_actionCounter.getTotal()); |
| 83 | this->_actionCounter.countAction(action); |
| 84 | } |
| 85 | |
| 86 | if (!visitedadd && action->isVisited()) |
| 87 | this->_visitedActions.emplace(action); |
| 88 | |
| 89 | if (!unvisitedadd && !action->isVisited()) |
| 90 | this->_unvisitedActions.emplace(action); |
| 91 | } |
| 92 | BDLOG("unvisited action: %zu, visited action %zu", this->_unvisitedActions.size(), |
| 93 | this->_visitedActions.size()); |
| 94 | } |
| 95 | |
| 96 | Graph::~Graph() { |
| 97 | this->_states.clear(); |
nothing calls this directly
no test coverage detected