Data cache
This commit is contained in:
parent
89e16fb805
commit
b5cc580cf8
5 changed files with 178 additions and 40 deletions
|
@ -52,20 +52,64 @@ enum class Lane(val value: Int) {
|
|||
|
||||
}
|
||||
|
||||
open class Arrows(val lanes: List<Lane>) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Arrows
|
||||
|
||||
return lanes == other.lanes
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return lanes.hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
class Lanes(lanes: List<Lane>) : Arrows(lanes)
|
||||
|
||||
class Outlines(lanes: List<Lane>) : Arrows(lanes)
|
||||
|
||||
class Distance(val distance: Int, val unit: Unit) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Distance
|
||||
|
||||
if (distance != other.distance) return false
|
||||
if (unit != other.unit) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = distance
|
||||
result = 31 * result + unit.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Speed(val speed: Int, val limit: Int)
|
||||
|
||||
class Arrival(val hours: Int, val minutes: Int)
|
||||
|
||||
class State {
|
||||
|
||||
var lineArrows: List<Lane> = listOf()
|
||||
var lineOutlines: List<Lane> = listOf()
|
||||
var direction = Direction()
|
||||
var distance: Int = 0
|
||||
var unit: Unit = Unit.Any
|
||||
var speed: Int = 0
|
||||
var limit: Int = 0
|
||||
var hours: Int = 0
|
||||
var minutes: Int = 0
|
||||
var traffic: Boolean = false
|
||||
var flag: Boolean = false
|
||||
var control: Boolean = false
|
||||
var lineArrows: Lanes? = null
|
||||
var lineOutlines: Outlines? = null
|
||||
var direction : Direction? = null
|
||||
var distance: Distance? = null
|
||||
var speed: Speed? = null
|
||||
var arrival: Arrival? = null
|
||||
// TODO: support
|
||||
var traffic: Boolean? = null
|
||||
var flag: Boolean? = null
|
||||
var control: Boolean? = null
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue