First hand history commit

hh
Laurent 6 years ago
parent 73b5fbcc4d
commit 1c2a4d0a09
  1. 42
      app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt
  2. 18
      app/src/main/java/net/pokeranalytics/android/model/handhistory/ComputedAction.kt
  3. 16
      app/src/main/java/net/pokeranalytics/android/model/realm/HandHistory.kt
  4. 1
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  5. 32
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/Action.kt
  6. 25
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/Card.kt
  7. 76
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt
  8. 29
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/PlayerSetup.kt

@ -0,0 +1,42 @@
package net.pokeranalytics.android.model.handhistory
import net.pokeranalytics.android.model.realm.handhistory.HandHistory
class Builder {
/***
* The hand history
*/
private var handHistory: HandHistory
set(value) {
field = value
load()
}
val actions: List<ComputedAction> = listOf()
constructor() {
this.handHistory = HandHistory()
}
constructor(handHistory: HandHistory) {
this.handHistory = handHistory
}
private fun load() {
var potSize = 0.0
// sorted actions
this.handHistory.actions.forEach {
val computedAction = ComputedAction(it, potSize, 0.0)
}
}
private fun save() {
}
}

@ -0,0 +1,18 @@
package net.pokeranalytics.android.model.handhistory
import net.pokeranalytics.android.model.realm.handhistory.Action
class ComputedAction(var action: Action,
var potSize: Double = 0.0,
var playerRemainingStack: Double = 0.0) {
/***
* The potsize is used:
* - in the replayer / video
* - in the list of actions by street
*/
// var potSize = 0.0
//
// var playerRemainingStack = 0.0
}

@ -1,16 +0,0 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class HandHistory : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// the date of the hand history
var date: Date = Date()
}

@ -26,6 +26,7 @@ import net.pokeranalytics.android.model.filter.Filterable
import net.pokeranalytics.android.model.filter.QueryCondition
import net.pokeranalytics.android.model.filter.QueryCondition.*
import net.pokeranalytics.android.model.interfaces.*
import net.pokeranalytics.android.model.realm.handhistory.HandHistory
import net.pokeranalytics.android.model.utils.SessionSetManager
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource
import net.pokeranalytics.android.ui.adapter.UnmanagedRowRepresentableException

@ -0,0 +1,32 @@
package net.pokeranalytics.android.model.realm.handhistory
import io.realm.RealmObject
open class Action : RealmObject() {
/***
* The street of the action
*/
var street: Int = 0
/***
* The index of the action
*/
var index: Int = 0
/***
* The position of the user making the action
*/
var position: Int = 0
/***
* The type of action: check, fold, raise...
*/
var type: Int = 0
/***
* The amount linked for a bet, raise...
*/
var amount: Double? = null
}

@ -0,0 +1,25 @@
package net.pokeranalytics.android.model.realm.handhistory
import io.realm.RealmObject
open class Card : RealmObject() {
enum class Suit {
SPADES,
HEART,
DIAMOND,
CLOVER
}
/***
* The card value: 2..A
*/
var value: Int = 0
/***
* The card suit: heart, spades...
*/
var suit: Int = 0
}

@ -0,0 +1,76 @@
package net.pokeranalytics.android.model.realm.handhistory
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import net.pokeranalytics.android.model.realm.Session
import java.util.*
open class HandHistory : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
/***
* The date of the hand history
*/
var date: Date = Date()
/***
* The session whose hand was played
*/
var session: Session? = null
/***
* The small blind
*/
var smallBlind: Double = 0.0
/***
* The big blind
*/
var bigBlind: Double = 0.0
/***
* The ante
*/
var ante: Double = 0.0
/***
* Big blind ante
*/
var bigBlindAnte: Boolean = false
/***
* Number of players in the hand
*/
var numberOfPlayers: Int = 9
/***
* Number of players in the hand
*/
var comment: String? = null
/***
* The position index of the hero
*/
var heroIndex: Int? = null
/***
* The board
*/
var board: RealmList<Card> = RealmList()
/***
* The players actions
*/
var actions: RealmList<Action> = RealmList()
/***
* A list of players initial data: user, position, hand, stack
*/
var playerSetups: RealmList<PlayerSetup> = RealmList()
}

@ -0,0 +1,29 @@
package net.pokeranalytics.android.model.realm.handhistory
import io.realm.RealmList
import io.realm.RealmObject
import net.pokeranalytics.android.model.realm.Player
open class PlayerSetup : RealmObject() {
/***
* The player
*/
var player: Player? = null
/***
* The position at the table: SB..BUTTON
*/
var position: Int = 0
/***
* The initial stack of the player
*/
var stack: Double? = null
/***
* The cards of the player
*/
var cards: RealmList<Card> = RealmList()
}
Loading…
Cancel
Save