|
|
|
@ -9,7 +9,12 @@ import net.pokeranalytics.android.ui.view.rowrepresentable.FilterElementRow.* |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
import kotlin.collections.ArrayList |
|
|
|
import kotlin.collections.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
open class FilterElement(var filterName : String = "", var sectionName: String = "") : RealmObject() { |
|
|
|
open class FilterElement() : RealmObject() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private constructor(filterName:String, sectionName:String) : this() { |
|
|
|
|
|
|
|
this.filterName = filterName |
|
|
|
|
|
|
|
this.sectionName = sectionName |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
constructor(filterElementRows: ArrayList<FilterElementRow>) : this(filterElementRows.first().filterName, filterElementRows.first().filterSectionRow.name) { |
|
|
|
constructor(filterElementRows: ArrayList<FilterElementRow>) : this(filterElementRows.first().filterName, filterElementRows.first().filterSectionRow.name) { |
|
|
|
this.stringValues = when (QueryType.valueOf(this.filterName)) { |
|
|
|
this.stringValues = when (QueryType.valueOf(this.filterName)) { |
|
|
|
@ -81,6 +86,9 @@ open class FilterElement(var filterName : String = "", var sectionName: String = |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var filterName : String = "" |
|
|
|
|
|
|
|
var sectionName : String = "" |
|
|
|
|
|
|
|
|
|
|
|
val queryType : QueryType |
|
|
|
val queryType : QueryType |
|
|
|
get() = QueryType.valueOf(filterName) |
|
|
|
get() = QueryType.valueOf(filterName) |
|
|
|
.apply { |
|
|
|
.apply { |
|
|
|
@ -93,7 +101,7 @@ open class FilterElement(var filterName : String = "", var sectionName: String = |
|
|
|
private var blindValues : RealmList<FilterElementBlind>? = null |
|
|
|
private var blindValues : RealmList<FilterElementBlind>? = null |
|
|
|
|
|
|
|
|
|
|
|
val ids : Array<String> |
|
|
|
val ids : Array<String> |
|
|
|
get() = stringValues?.toTypedArray()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = stringValues?.toTypedArray()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
val blinds : RealmList<FilterElementBlind> |
|
|
|
val blinds : RealmList<FilterElementBlind> |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
@ -109,36 +117,36 @@ open class FilterElement(var filterName : String = "", var sectionName: String = |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val date : Date |
|
|
|
val date : Date |
|
|
|
get() = dateValue?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = dateValue?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val values : Array<Int> |
|
|
|
val values : Array<Int> |
|
|
|
get() = numericValues?.map { |
|
|
|
get() = numericValues?.map { |
|
|
|
it.toInt() |
|
|
|
it.toInt() |
|
|
|
}?.toTypedArray()?: throw FilterValueMapException("filter type not handled") |
|
|
|
}?.toTypedArray()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val value : Double |
|
|
|
val value : Double |
|
|
|
get() = numericValues?.first()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = numericValues?.first()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val leftValue : Double |
|
|
|
val leftValue : Double |
|
|
|
get() = numericValues?.first()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = numericValues?.first()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val rightValue : Double |
|
|
|
val rightValue : Double |
|
|
|
get() = numericValues?.last()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = numericValues?.last()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val dayOfWeek : Int |
|
|
|
val dayOfWeek : Int |
|
|
|
get() = numericValues?.first()?.toInt()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = numericValues?.first()?.toInt()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val month : Int |
|
|
|
val month : Int |
|
|
|
get() = numericValues?.first()?.toInt()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = numericValues?.first()?.toInt()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val year : Int |
|
|
|
val year : Int |
|
|
|
get() = numericValues?.first()?.toInt()?: throw FilterValueMapException("filter type not handled") |
|
|
|
get() = numericValues?.first()?.toInt()?: throw FilterValueMapException("filter type not handled") |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|