Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1e21b93 authored by Mike Schneider's avatar Mike Schneider
Browse files

Make debug printing more useful

Flag: EXEMPT Not used in production
Bug: 391553479
Test: Manual, inspected value during debugging
Change-Id: I9cde0e6d18cf6604f6869e23df6bddf9bbca17d3
parent 26104a85
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ class BreakpointKey(val debugLabel: String? = null, val identity: Any = Object()
    }

    override fun toString(): String {
        return if (debugLabel != null) "BreakpointKey(label=$debugLabel)" else "BreakpointKey()"
        return "BreakpointKey(${debugLabel ?: ""}" +
            "@${System.identityHashCode(identity).toString(16).padStart(8,'0')})"
    }
}

+16 −1
Original line number Diff line number Diff line
@@ -28,7 +28,11 @@ data class SegmentKey(
    val minBreakpoint: BreakpointKey,
    val maxBreakpoint: BreakpointKey,
    val direction: InputDirection,
)
) {
    override fun toString(): String {
        return "SegmentKey(min=$minBreakpoint, max=$maxBreakpoint, direction=$direction)"
    }
}

/**
 * Captures denormalized segment data from a [MotionSpec].
@@ -80,6 +84,13 @@ data class SegmentData(
    fun <T> semantic(semanticKey: SemanticKey<T>): T? {
        return spec.semanticState(semanticKey, key)
    }

    val range: ClosedFloatingPointRange<Float>
        get() = minBreakpoint.position..maxBreakpoint.position

    override fun toString(): String {
        return "SegmentData(key=$key, range=$range, mapping=$mapping)"
    }
}

/**
@@ -96,6 +107,10 @@ fun interface Mapping {
        override fun map(input: Float): Float {
            return input
        }

        override fun toString(): String {
            return "Identity"
        }
    }

    /** `f(x) = value` */