<commit_before>//
// Created by aleksey on 05.11.15.
// Copyright (c) 2015 <NAME>. All rights reserved.
//

import Foundation

public struct StaticObjectsSection<U> {
  
  var title: String?
  var objects: [U]
  
  public init(title: String?, objects: [U]) {
    self.title = title
    self.objects = objects
  }
  
}

public class StaticDataSource<ObjectType> : ObjectsDataSource<ObjectType> {
  
  public override init() { }
  
  public var sections: [StaticObjectsSection<ObjectType>] = [] {
    didSet { reloadDataSignal.sendNext() }
  }
  
  override func numberOfSections() -> Int {
    return sections.count
  }
  
  override func numberOfObjectsInSection(section: Int) -> Int {
    return sections[section].objects.count
  }
  
  override func objectAtIndexPath(indexPath: NSIndexPath) -> ObjectType? {
    return sections[indexPath.section].objects[indexPath.row]
  }
  
}<commit_msg>Update StaticDataSource.swift<commit_after>//
// Created by aleksey on 05.11.15.
// Copyright (c) 2015 <NAME>. All rights reserved.
//

import Foundation

public struct StaticObjectsSection<U> {
  
  var title: String?
  var objects: [U]
  
  public init(title: String?, objects: [U]) {
    self.title = title
    self.objects = objects
  }
  
}

public class StaticDataSource<ObjectType> : ObjectsDataSource<ObjectType> {
  
  public override init() { }
  
  public var sections: [StaticObjectsSection<ObjectType>] = [] {
    didSet { reloadDataSignal.sendNext() }
  }
  
  override func numberOfSections() -> Int {
    return sections.count
  }
  
  override func numberOfObjectsInSection(section: Int) -> Int {
    return sections[section].objects.count
  }
  
  override func objectAtIndexPath(indexPath: NSIndexPath) -> ObjectType? {
    return sections[indexPath.section].objects[indexPath.row]
  }
  
  public func indexPathFor(object: ObjectType) -> NSIndexPath {
    var objectRow = 0
    var objectSection = 0
    var objectFound = false
    
    for (index, section) in sections.enumerate() {
      if section.objects.contains(object) {
        objectFound = true
        objectSection = index
        objectRow = section.objects.indexOf(object)!
      }
    }
    
    return NSIndexPath(forRow: objectRow, inSection: objectSection) 
  }
  
}
{'fraction_non_alphanumeric': 0.10769915442812639, 'fraction_numerical': 0.009790832220738763, 'mean_word_length': 3.241509433962264, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 20, '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': '5319099', 'n_tokens_mistral': 709, 'n_tokens_neox': 674, 'n_words': 165}