Refactoring + implementation of dropNextActionsIfNecessary

hh
Laurent 6 years ago
parent 8dcf26815d
commit c1e09c41eb
  1. 8
      app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt

@ -143,9 +143,7 @@ class Builder {
val computedAction = this.sortedActions.first { it.action.index == index }
computedAction.action.type = actionType
dropIfNecessary(index)
// remaining stack + effective amount
dropNextActionsIfNecessary(index)
when (actionType) {
Action.Type.CALL -> {
@ -164,9 +162,11 @@ class Builder {
return computedAction.requireAmount
}
private fun dropIfNecessary(index: Int) {
private fun dropNextActionsIfNecessary(index: Int) {
if (index > this.handHistory.numberOfPlayers) {
this.sortedActions.drop(index + 1)
}
}
/***
* Sets the amount for the action at the provided [index]

Loading…
Cancel
Save