MileageAlgorithmRegistry
class MileageAlgorithmRegistry(factories: Map<AlgorithmId, (TuningProfile, DeviceEnvelope) -> MileageAlgorithm> = emptyMap())
Where algorithms are looked up by id.
Deliberately a plain map rather than a service-loader or DI-aware thing: it must work identically in a unit test, in a sweep harness on the desktop, and in the app.
Constructors
Link copied to clipboard
constructor(factories: Map<AlgorithmId, (TuningProfile, DeviceEnvelope) -> MileageAlgorithm> = emptyMap())
Functions
Link copied to clipboard
fun create(profile: TuningProfile, envelope: DeviceEnvelope = DeviceEnvelope.Default): MileageAlgorithm
Link copied to clipboard
fun register(id: AlgorithmId, factory: (TuningProfile, DeviceEnvelope) -> MileageAlgorithm): MileageAlgorithmRegistry