<commit_before>//
//  TimeElement.swift
//  alarm
//
//  Created by <NAME> on 3/8/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import Foundation

class TimeElement {
  var hour: Int
  var minute: Int
  var amOrPm: String // either "am" or "pm"


  init(hour: Int, minute: Int) {
    // Determine AM vs PM and adjust the hour to a 12 hour clock
    if hour < 12 {
      self.hour = hour
      self.amOrPm = "am"
    } else {
      self.hour = hour - 12
      self.amOrPm = "pm"
    }

    if self.hour == 0 {
      self.hour = 12
    }

    self.minute = minute
  }

  func wheelDisplayStr() -> String {
    // Special formatting for special times
    if hour == 0 && minute == 0 {
      return "midnight"
    } else if hour == 12 && minute == 0 {
      return "noon"
    } else {
      return String(format: "%02d : %02d", self.hour, self.minute)
    }
  }

  func tableDisplayStr() -> String {
    // Special formatting for special times
    if hour == 0 && minute == 0 {
      return "midnight"
    } else if hour == 12 && minute == 0 {
      return "noon"
    } else {
      return String(format: "%02d:%02d %@", self.hour, self.minute, self.amOrPm)
    }
  }

  // Generate all of the time elements that we will allow
  class func generateAllElements() -> Array<TimeElement> {
    return (0...23).map {
      hour in
      [0, 15, 30, 45].map {
        minute in<commit_msg>init a TimeElement using an AlarmEntity<commit_after>//
//  TimeElement.swift
//  alarm
//
//  Created by <NAME> on 3/8/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import Foundation

class TimeElement {
  var hour: Int
  var minute: Int
  var amOrPm: String // either "am" or "pm"


  init(hour: Int, minute: Int) {
    // Determine AM vs PM and adjust the hour to a 12 hour clock
    if hour < 12 {
      self.hour = hour
      self.amOrPm = "am"
    } else {
      self.hour = hour - 12
      self.amOrPm = "pm"
    }

    if self.hour == 0 {
      self.hour = 12
    }

    self.minute = minute
  }

  init(alarm: AlarmEntity) {
    init(hour: alarm.hour, minute: alarm.minute)
  }

  func wheelDisplayStr() -> String {
    // Special formatting for special times
    if hour == 0 && minute == 0 {
      return "midnight"
    } else if hour == 12 && minute == 0 {
      return "noon"
    } else {
      return String(format: "%02d : %02d", self.hour, self.minute)
    }
  }

  func tableDisplayStr() -> String {
    // Special formatting for special times
    if hour == 0 && minute == 0 {
      return "midnight"
    } else if hour == 12 && minute == 0 {
      return "noon"
    } else {
      return String(format: "%02d:%02d %@", self.hour, self.minute, self.amOrPm)
    }
  }

  // Generate all of the time elements that we will allow
  class func generateAllElements() -> Array<TimeElement> {
    return (0...23).map {
      hour in
      [0, 15, 30, 45].map {
        minute in
{'fraction_non_alphanumeric': 0.13264248704663212, 'fraction_numerical': 0.031088082901554404, 'mean_word_length': 2.058078141499472, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '2606776', 'n_tokens_mistral': 1039, 'n_tokens_neox': 945, 'n_words': 316}