<commit_before>//
//  Parent.swift
//  AccordionSwift
//
//  Created by <NAME> on 7/5/18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import Foundation

/// Defines the state of a cell
public enum State {
    case collapsed
    case expanded
}

public protocol ParentType {
    
    // MARK: - Associated Types
    
    /// The type of item in the ParentType
    associatedtype Item
    
    /// The type of item in the Child
    associatedtype ChildItem
    
    /// The current state of the cell
    var state: State { get set }
    
    /// The item in the parent cell
    var item: Item { get }
    
    /// The children of the cell
    var children: [ChildItem] { get }
}

/// Defines the Parent model for the cells
public class Parent<Item, ChildItem>: ParentType {
    
    // MARK: - Properties
    
    /// The current state of the cell
    public var state: State
    
    /// The item in the parent cell
    public let item: Item
    
    /// The children of the cell
    public let children: [ChildItem]
    
    // MARK: - Initializer
    
    /// Construct a new Parent model
    ///
    /// - Parameters:
    ///   - state: The state of the cell
    ///   - item: The item in the cell
    ///   - children: The children assigned to the cell
    public init(state: State = .collapsed, item: Item, children: [ChildItem]) {
        self.state = state
        self.item = item
        self.children = children
    }
}<commit_msg>Added enum to parent type for number of cells allowed to be expanded<commit_after>//
//  Parent.swift
//  AccordionSwift
//
//  Created by <NAME> on 7/5/18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import Foundation

/// Defines the state of a cell
public enum State {
    case collapsed
    case expanded
}

// Defines if there can be multiple cells expanded at once
public enum NumberCellsExpanded {
    case single
    case multiple
}

public protocol ParentType {

    // MARK: - Associated Types

    /// The type of item in the ParentType
    associatedtype Item

    /// The type of item in the Child
    associatedtype ChildItem

    /// The current state of the cell
    var state: State { get set }

    /// The item in the parent cell
    var item: Item { get }

    /// The children of the cell
    var children: [ChildItem] { get }
}

/// Defines the Parent model for the cells
public class Parent<Item, ChildItem>: ParentType {

    // MARK: - Properties

    /// The current state of the cell
    public var state: State

    /// The item in the parent cell
    public let item: Item

    /// The children of the cell
    public let children: [ChildItem]

    // MARK: - Initializer

    /// Construct a new Parent model
    ///
    /// - Parameters:
    ///   - state: The state of the cell
    ///   - item: The item in the cell
    ///   - children: The children assigned to the cell
    public init(state: State = .collapsed, item: Item, children: [ChildItem]) {
        self.state = state
        self.item = item
        self.children = children
    }
}
{'fraction_non_alphanumeric': 0.09417188014487982, 'fraction_numerical': 0.005268356931182087, 'mean_word_length': 1.9552529182879377, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1733370', 'n_tokens_mistral': 870, 'n_tokens_neox': 831, 'n_words': 365}