| 269 | |
| 270 | |
| 271 | ActivityStateActionPtr State::resolveAt(ActivityStateActionPtr action, time_t t) { |
| 272 | if (action->getTarget() == nullptr) |
| 273 | return action; |
| 274 | uintptr_t h = action->getTarget()->hash(); |
| 275 | auto targetWidgets = this->_mergedWidgets.find(h); |
| 276 | if (targetWidgets == this->_mergedWidgets.end()) { |
| 277 | return action; |
| 278 | } |
| 279 | int total = (int) (this->_mergedWidgets.at(h).size()); |
| 280 | int index = action->getVisitedCount() % total; |
| 281 | BLOG("resolve a merged widget %d/%d for action %s", index, total, action->getId().c_str()); |
| 282 | action->setTarget(this->_mergedWidgets.at(h)[index]); |
| 283 | return action; |
| 284 | } |
| 285 | |
| 286 | bool State::containsTarget(const WidgetPtr &widget) const { |
| 287 | for (const auto &w: this->_widgets) { |
no test coverage detected