<commit_before>//
//  BatteryChemistryType.swift
//  RileyLink
//
//  Created by <NAME> on 11/15/16
//  Copyright © 2016 LoopKit Authors. All rights reserved.
//

import Foundation

public enum BatteryChemistryType: Int, CustomStringConvertible {
    case alkaline = 0
    case lithium

    public var description: String {
        switch self {
        case .alkaline:
            return NSLocalizedString("Alkaline", comment: "Describing the battery chemistry as Alkaline")
        case .lithium:
            return NSLocalizedString("Lithium", comment: "Describing the battery chemistry as Lithium")
        }
    }

    public var maxVoltage: Double {
        switch self {
        case .alkaline:
            return 1.58
        case .lithium:
            return 1.58
        }
    }

    public var minVoltage: Double {
        switch self {
        case .alkaline:
            return 1.26
        case .lithium:
            return 1.32
        }
    }

    public func chargeRemaining(voltage: Double) -> Double {
        let computed = (voltage - self.minVoltage)/(self.maxVoltage - self.minVoltage)
        return max(min(computed, 1), 0)
    }
}
<commit_msg>Update max and min voltages for alkaline percent remaining math<commit_after>//
//  BatteryChemistryType.swift
//  RileyLink
//
//  Created by <NAME> on 11/15/16
//  Copyright © 2016 LoopKit Authors. All rights reserved.
//

import Foundation

public enum BatteryChemistryType: Int, CustomStringConvertible {
    case alkaline = 0
    case lithium

    public var description: String {
        switch self {
        case .alkaline:
            return NSLocalizedString("Alkaline", comment: "Describing the battery chemistry as Alkaline")
        case .lithium:
            return NSLocalizedString("Lithium", comment: "Describing the battery chemistry as Lithium")
        }
    }

    public var maxVoltage: Double {
        switch self {
        case .alkaline:
            return 1.47
        case .lithium:
            return 1.58
        }
    }

    public var minVoltage: Double {
        switch self {
        case .alkaline:
            return 1.20
        case .lithium:
            return 1.32
        }
    }

    public func chargeRemaining(voltage: Double) -> Double {
        let computed = (voltage - self.minVoltage)/(self.maxVoltage - self.minVoltage)
        return max(min(computed, 1), 0)
    }
}

{'fraction_non_alphanumeric': 0.08466051969823973, 'fraction_numerical': 0.020955574182732608, 'mean_word_length': 1.98375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3207443', 'n_tokens_mistral': 759, 'n_tokens_neox': 673, 'n_words': 205}