|
|
|
@ -3,74 +3,102 @@ package net.pokeranalytics.android.model.realm.handhistory |
|
|
|
import io.realm.RealmList |
|
|
|
import io.realm.RealmList |
|
|
|
import io.realm.RealmObject |
|
|
|
import io.realm.RealmObject |
|
|
|
import io.realm.annotations.PrimaryKey |
|
|
|
import io.realm.annotations.PrimaryKey |
|
|
|
|
|
|
|
import net.pokeranalytics.android.model.handhistory.HandSetup |
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open class HandHistory : RealmObject() { |
|
|
|
open class HandHistory : RealmObject() { |
|
|
|
|
|
|
|
|
|
|
|
@PrimaryKey |
|
|
|
@PrimaryKey |
|
|
|
var id = UUID.randomUUID().toString() |
|
|
|
var id = UUID.randomUUID().toString() |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The date of the hand history |
|
|
|
* The date of the hand history |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var date: Date = Date() |
|
|
|
var date: Date = Date() |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The session whose hand was played |
|
|
|
* The session whose hand was played |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var session: Session? = null |
|
|
|
var session: Session? = null |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The small blind |
|
|
|
* The small blind |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var smallBlind: Double = 0.0 |
|
|
|
var smallBlind: Double = 0.0 |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The big blind |
|
|
|
* The big blind |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var bigBlind: Double = 0.0 |
|
|
|
var bigBlind: Double = 0.0 |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The ante |
|
|
|
* The ante |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var ante: Double = 0.0 |
|
|
|
var ante: Double = 0.0 |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Big blind ante |
|
|
|
* Big blind ante |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var bigBlindAnte: Boolean = false |
|
|
|
var bigBlindAnte: Boolean = false |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Number of players in the hand |
|
|
|
* Number of players in the hand |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var numberOfPlayers: Int = 9 |
|
|
|
var numberOfPlayers: Int = 9 |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Number of players in the hand |
|
|
|
* Number of players in the hand |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var comment: String? = null |
|
|
|
var comment: String? = null |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The position index of the hero |
|
|
|
* The position index of the hero |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var heroIndex: Int? = null |
|
|
|
var heroIndex: Int? = null |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The board |
|
|
|
* The board |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var board: RealmList<Card> = RealmList() |
|
|
|
var board: RealmList<Card> = RealmList() |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The players actions |
|
|
|
* The players actions |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var actions: RealmList<Action> = RealmList() |
|
|
|
var actions: RealmList<Action> = RealmList() |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* A list of players initial data: user, position, hand, stack |
|
|
|
* A list of players initial data: user, position, hand, stack |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var playerSetups: RealmList<PlayerSetup> = RealmList() |
|
|
|
var playerSetups: RealmList<PlayerSetup> = RealmList() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun configure(handSetup: HandSetup) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handSetup.tableSize?.let { this.numberOfPlayers = it } |
|
|
|
|
|
|
|
handSetup.smallBlind?.let { this.smallBlind = it } |
|
|
|
|
|
|
|
handSetup.bigBlind?.let { this.bigBlind = it } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i in 0..this.numberOfPlayers) { |
|
|
|
|
|
|
|
val action = Action() |
|
|
|
|
|
|
|
action.index = i |
|
|
|
|
|
|
|
action.position = i |
|
|
|
|
|
|
|
when (i) { |
|
|
|
|
|
|
|
0 -> { |
|
|
|
|
|
|
|
action.type = Action.Type.POST_SB.ordinal |
|
|
|
|
|
|
|
action.amount = this.smallBlind |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
1 -> { |
|
|
|
|
|
|
|
action.type = Action.Type.POST_BB.ordinal |
|
|
|
|
|
|
|
action.amount = this.bigBlind |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.actions.add(action) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |