|
|
|
@ -11,21 +11,16 @@ class StraddleRowRepresentable( |
|
|
|
override val viewType: Int = HandRowType.STRADDLE.ordinal |
|
|
|
override val viewType: Int = HandRowType.STRADDLE.ordinal |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Tries to add a position if the position is next to another |
|
|
|
* Adds the position to the straddle selections |
|
|
|
|
|
|
|
* Returns whether the position has been added or not |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun add(position: Position): Boolean { |
|
|
|
fun add(position: Position): Boolean { |
|
|
|
val canAdd = this.selectedPositions.isEmpty() |
|
|
|
this.selectedPositions.add(position) |
|
|
|
|| this.selectedPositions.any { it.ordinal == position.ordinal + 1 || it.ordinal == position.ordinal - 1 } |
|
|
|
return true |
|
|
|
|
|
|
|
|
|
|
|
if (canAdd) { |
|
|
|
|
|
|
|
this.selectedPositions.add(position) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return canAdd |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Removes a position |
|
|
|
* Removes a position from the straddle list |
|
|
|
* Should not let holes |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun remove(position: Position) { |
|
|
|
fun remove(position: Position) { |
|
|
|
this.selectedPositions.remove(position) |
|
|
|
this.selectedPositions.remove(position) |
|
|
|
|