<commit_before>//
//  ReactiveSetSection.swift
//  MantleData
//
//  Created by Anders on 6/5/2016.
//  Copyright © 2016 Anders. All rights reserved.
//

import Foundation

/// Section of ReactiveSet

public protocol ReactiveSetSectionGenerator: GeneratorType {
	associatedtype Element: Equatable
}

public protocol ReactiveSetSection: CollectionType {
	associatedtype Generator: ReactiveSetSectionGenerator
	associatedtype Index: ReactiveSetIndex

	var name: ReactiveSetSectionName { get }
}

public func == <S: ReactiveSetSection>(left: S, right: S) -> Bool {
	return left.name == right.name
}

extension ReactiveSetSection where Index: ReactiveSetIndex {
	public subscript(index: Int) -> Generator.Element {
		return self[Index(converting: index)]
	}

	public subscript(index: AnyReactiveSetIndex) -> Generator.Element {
		return self[Index(converting: index)]
	}
}


public struct AnyReactiveSetSectionIterator<E: Equatable>: ReactiveSetSectionGenerator {
	public typealias Element = E

	private let generator: () -> Element?

	public init(generator: () -> Element?) {
		self.generator = generator
	}

	public mutating func next() -> Element? {
		return generator()
	}
}

/// Section Name of ReactiveSet

public struct ReactiveSetSectionName: Hashable {
	public let value: String?

	public init() {
		self.value = nil
	}

	public init(exact string: String) {
		self.value = string
	}

	public init(converting object: AnyObject?) {<commit_msg>Remove unnecessary subscript overloads in `ReactiveSetSection`.<commit_after>//
//  ReactiveSetSection.swift
//  MantleData
//
//  Created by Anders on 6/5/2016.
//  Copyright © 2016 Anders. All rights reserved.
//

import Foundation

/// Section of ReactiveSet

public protocol ReactiveSetSectionGenerator: GeneratorType {
	associatedtype Element: Equatable
}

public protocol ReactiveSetSection: CollectionType {
	associatedtype Generator: ReactiveSetSectionGenerator
	associatedtype Index: ReactiveSetIndex

	var name: ReactiveSetSectionName { get }
}

public func == <S: ReactiveSetSection>(left: S, right: S) -> Bool {
	return left.name == right.name
}

public struct AnyReactiveSetSectionIterator<E: Equatable>: ReactiveSetSectionGenerator {
	public typealias Element = E

	private let generator: () -> Element?

	public init(generator: () -> Element?) {
		self.generator = generator
	}

	public mutating func next() -> Element? {
		return generator()
	}
}

/// Section Name of ReactiveSet

public struct ReactiveSetSectionName: Hashable {
	public let value: String?

	public init() {
		self.value = nil
	}

	public init(exact string: String) {
		self.value = string
	}

	public init(converting object: AnyObject?) {
{'fraction_non_alphanumeric': 0.09895052473763119, 'fraction_numerical': 0.0074962518740629685, 'mean_word_length': 4.435845213849287, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '3085676', 'n_tokens_mistral': 832, 'n_tokens_neox': 773, 'n_words': 230}