<commit_before>import UIKit
import Neon
import DateTools

protocol DaySelectorDelegate: class {
  func dateSelectorDidSelectDate(date: NSDate, index: Int)
}

class DaySelector: UIView {

  weak var delegate: DaySelectorDelegate?

  //TODO: change to support Work-week only (5 days instead of 7)
  var daysInWeek = 7
  var startDate: NSDate! {
    didSet {
      configure()
    }
  }

  var selectedIndex = -1 {
    didSet {
      dateLabels.filter {$0.selected == true}
        .first?.selected = false
      let label = dateLabels[selectedIndex]
      label.selected = true
      delegate?.dateSelectorDidSelectDate(label.date, index: selectedIndex)
    }
  }

  var dateLabelWidth: CGFloat = 35

  var dateLabels = [DateLabel]()

  init(startDate: NSDate) {
    self.startDate = startDate
    super.init(frame: CGRect.zero)
    initializeViews()
    configure()
  }

  override init(frame: CGRect) {
    startDate = NSDate()
    super.init(frame: frame)<commit_msg>Add selected date computed property to DaySelector<commit_after>import UIKit
import Neon
import DateTools

protocol DaySelectorDelegate: class {
  func dateSelectorDidSelectDate(date: NSDate, index: Int)
}

class DaySelector: UIView {

  weak var delegate: DaySelectorDelegate?

  //TODO: change to support Work-week only (5 days instead of 7)
  var daysInWeek = 7
  var startDate: NSDate! {
    didSet {
      configure()
    }
  }

  var selectedIndex = -1 {
    didSet {
      dateLabels.filter {$0.selected == true}
        .first?.selected = false
      let label = dateLabels[selectedIndex]
      label.selected = true
    }
  }

  var selectedDate: NSDate? {
    return dateLabels.filter{$0.selected == true}.first?.date
  }

  var dateLabelWidth: CGFloat = 35

  var dateLabels = [DateLabel]()

  init(startDate: NSDate) {
    self.startDate = startDate
    super.init(frame: CGRect.zero)
    initializeViews()
    configure()
  }

  override init(frame: CGRect) {
    startDate = NSDate()
    super.init(frame: frame)
{'fraction_non_alphanumeric': 0.09679037111334002, 'fraction_numerical': 0.007522567703109328, 'mean_word_length': 3.1736401673640167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1983281', 'n_tokens_mistral': 636, 'n_tokens_neox': 616, 'n_words': 166}