| 219 | } |
| 220 | |
| 221 | bool Sequence::init(const Vector<FiniteTimeAction*>& arrayOfActions) |
| 222 | { |
| 223 | auto count = arrayOfActions.size(); |
| 224 | if (count == 0) |
| 225 | return false; |
| 226 | |
| 227 | if (count == 1) |
| 228 | return initWithTwoActions(arrayOfActions.at(0), ExtraAction::create()); |
| 229 | |
| 230 | // else size > 1 |
| 231 | auto prev = arrayOfActions.at(0); |
| 232 | for (int i = 1; i < count - 1; ++i) |
| 233 | { |
| 234 | prev = createWithTwoActions(prev, arrayOfActions.at(i)); |
| 235 | } |
| 236 | |
| 237 | return initWithTwoActions(prev, arrayOfActions.at(count - 1)); |
| 238 | } |
| 239 | |
| 240 | bool Sequence::initWithTwoActions(FiniteTimeAction* actionOne, FiniteTimeAction* actionTwo) |
| 241 | { |