|
|
|
@ -1,11 +1,11 @@ |
|
|
|
package net.pokeranalytics.android.model.handhistory |
|
|
|
package net.pokeranalytics.android.ui.modules.handhistory |
|
|
|
|
|
|
|
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
|
|
|
|
import net.pokeranalytics.android.model.handhistory.* |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.Action |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.Action |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.Card |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.Card |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.HandHistory |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.HandHistory |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.HandRowType |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.CardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.CardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.PlayerCardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.PlayerCardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.StreetCardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.StreetCardsRow |
|
|
|
@ -100,7 +100,12 @@ class HHBuilder { |
|
|
|
sortedActions.forEach { action -> |
|
|
|
sortedActions.forEach { action -> |
|
|
|
totalPotSize += action.effectiveAmount |
|
|
|
totalPotSize += action.effectiveAmount |
|
|
|
val position = this.positions.elementAt(action.position) |
|
|
|
val position = this.positions.elementAt(action.position) |
|
|
|
val ca = ComputedAction(action, totalPotSize, action.positionRemainingStack, position) |
|
|
|
val ca = ComputedAction( |
|
|
|
|
|
|
|
action, |
|
|
|
|
|
|
|
totalPotSize, |
|
|
|
|
|
|
|
action.positionRemainingStack, |
|
|
|
|
|
|
|
position |
|
|
|
|
|
|
|
) |
|
|
|
computedActions.add(ca) |
|
|
|
computedActions.add(ca) |
|
|
|
} |
|
|
|
} |
|
|
|
this.sortedActions = computedActions |
|
|
|
this.sortedActions = computedActions |
|
|
|
@ -228,9 +233,6 @@ class HHBuilder { |
|
|
|
else -> {} |
|
|
|
else -> {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
structureModified = this.updateFollowupActions(index) || structureModified |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Automatically sets action for the previous empty actions |
|
|
|
// Automatically sets action for the previous empty actions |
|
|
|
val modifiedActions = mutableListOf<ComputedAction>() |
|
|
|
val modifiedActions = mutableListOf<ComputedAction>() |
|
|
|
getPreviousEmptyActions(index).forEach { |
|
|
|
getPreviousEmptyActions(index).forEach { |
|
|
|
@ -243,6 +245,8 @@ class HHBuilder { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
structureModified = this.updateFollowupActions(index) || structureModified |
|
|
|
|
|
|
|
|
|
|
|
if (structureModified) return null |
|
|
|
if (structureModified) return null |
|
|
|
return modifiedActions.map { this.rowRepresentables.indexOf(it) } |
|
|
|
return modifiedActions.map { this.rowRepresentables.indexOf(it) } |
|
|
|
} |
|
|
|
} |
|
|
|
@ -320,7 +324,13 @@ class HHBuilder { |
|
|
|
action.index = this.sortedActions.size |
|
|
|
action.index = this.sortedActions.size |
|
|
|
action.position = position.ordinal |
|
|
|
action.position = position.ordinal |
|
|
|
action.street = street |
|
|
|
action.street = street |
|
|
|
val computedAction = ComputedAction(action, currentPotSize, remainingStack, position) |
|
|
|
val computedAction = |
|
|
|
|
|
|
|
ComputedAction( |
|
|
|
|
|
|
|
action, |
|
|
|
|
|
|
|
currentPotSize, |
|
|
|
|
|
|
|
remainingStack, |
|
|
|
|
|
|
|
position |
|
|
|
|
|
|
|
) |
|
|
|
this.sortedActions.add(computedAction) |
|
|
|
this.sortedActions.add(computedAction) |
|
|
|
this.rowRepresentables.add(computedAction) |
|
|
|
this.rowRepresentables.add(computedAction) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -553,7 +563,10 @@ class HHBuilder { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun setNumberOfPlayers(playerCount: Int) { |
|
|
|
fun setNumberOfPlayers(playerCount: Int) { |
|
|
|
this.handHistory.numberOfPlayers = playerCount |
|
|
|
this.handHistory.numberOfPlayers = playerCount |
|
|
|
this.positions = Position.positionsPerPlayers(playerCount) |
|
|
|
this.positions = |
|
|
|
|
|
|
|
Position.positionsPerPlayers( |
|
|
|
|
|
|
|
playerCount |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
@ -575,7 +588,10 @@ class HHBuilder { |
|
|
|
if (index >= startIndex && rowRepresentable is HandHistoryRow) { |
|
|
|
if (index >= startIndex && rowRepresentable is HandHistoryRow) { |
|
|
|
val foundKeyboard = rowRepresentable.keyboardForCompletion() |
|
|
|
val foundKeyboard = rowRepresentable.keyboardForCompletion() |
|
|
|
if (foundKeyboard != null) { |
|
|
|
if (foundKeyboard != null) { |
|
|
|
return HHSelection(index, foundKeyboard) |
|
|
|
return HHSelection( |
|
|
|
|
|
|
|
index, |
|
|
|
|
|
|
|
foundKeyboard |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |