fix: DataCache & State domain fixes
This commit is contained in:
parent
af2b3cce5c
commit
6f3643a2b4
2 changed files with 22 additions and 18 deletions
|
@ -38,24 +38,7 @@ class DataCache {
|
||||||
|
|
||||||
// Merge states
|
// Merge states
|
||||||
fun update(state: State) {
|
fun update(state: State) {
|
||||||
if (state.lineArrows != null) {
|
stateCache.merge(state)
|
||||||
stateCache.lineArrows = state.lineArrows
|
|
||||||
}
|
|
||||||
if (state.lineOutlines != null) {
|
|
||||||
state.lineOutlines = state.lineOutlines
|
|
||||||
}
|
|
||||||
if (state.direction != null) {
|
|
||||||
stateCache.direction = state.direction
|
|
||||||
}
|
|
||||||
if (state.distance != null) {
|
|
||||||
stateCache.distance = state.distance
|
|
||||||
}
|
|
||||||
if (state.speed != null) {
|
|
||||||
stateCache.speed = state.speed
|
|
||||||
}
|
|
||||||
if (state.arrival != null) {
|
|
||||||
stateCache.arrival = state.arrival
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// maneuver
|
// maneuver
|
||||||
|
|
|
@ -111,6 +111,27 @@ class State {
|
||||||
var traffic: Boolean? = null
|
var traffic: Boolean? = null
|
||||||
var flag: Boolean? = null
|
var flag: Boolean? = null
|
||||||
var control: Boolean? = null
|
var control: Boolean? = null
|
||||||
|
|
||||||
|
fun merge(other: State) {
|
||||||
|
if (other.lineArrows != null) {
|
||||||
|
this.lineArrows = other.lineArrows
|
||||||
|
}
|
||||||
|
if (other.lineOutlines != null) {
|
||||||
|
this.lineOutlines = other.lineOutlines
|
||||||
|
}
|
||||||
|
if (other.direction != null) {
|
||||||
|
this.direction = other.direction
|
||||||
|
}
|
||||||
|
if (other.distance != null) {
|
||||||
|
this.distance = other.distance
|
||||||
|
}
|
||||||
|
if (other.speed != null) {
|
||||||
|
this.speed = other.speed
|
||||||
|
}
|
||||||
|
if (other.arrival != null) {
|
||||||
|
this.arrival = other.arrival
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue