<commit_before>//
//  Container.swift
//
//  Copyright (c) 2015 <NAME>.
//

import Foundation

/**
    Abstract container type with two ends: head and tail
*/
public protocol Container: MutableCollectionType {
    /// Whether the container is empty
    var isEmpty: Bool { get }
    
    /// Number of elements in the container
    var count: Int { get }
    
    /// Remove all elements in the container
    mutating func removeAll()

    // This is here to force the typealias Index to be Int
    subscript (index: Int) -> Self.Generator.Element { get set }
}

/**
    Double ended container that can insert and remove elements at both ends (front and back).
    The container is subscriptable from the front (index zero) to the back (largest index)
*/
public protocol DoubleEndedContainer: Container, QueueType {
    /// Element at the back of the container
    var back: Self.Generator.Element? { get set }
    
    /// Element at the front of the container
    var front: Self.Generator.Element? { get set }
    
    /// Insert a new element at the front
    mutating func pushFront(item: Self.Generator.Element)
    
    /// Insert a new element at the back
    mutating func pushBack(item: Self.Generator.Element)
    
    /// Remove an element from the front and return it if there is one
    mutating func popFront() -> Self.Generator.Element?
    
    /// Remove an element from the back and return it if there is one
    mutating func popBack() -> Self.Generator.Element?
}<commit_msg>refactor: cleaner DoubleEndedContainer<commit_after>//
//  Container.swift
//
//  Copyright (c) 2015 <NAME>.
//

import Foundation

/**
    Abstract container type with two ends: head and tail
*/
public protocol Container: MutableCollectionType {
    /// Whether the container is empty
    var isEmpty: Bool { get }
    
    /// Number of elements in the container
    var count: Int { get }
    
    /// Remove all elements in the container
    mutating func removeAll()

    // This is here to force the typealias Index to be Int
    subscript (index: Int) -> Self.Generator.Element { get set }
}

/**
    Double ended container that can insert and remove elements at both ends (front and back).
    The container is subscriptable from the front (index zero) to the back (largest index)
*/
public protocol DoubleEndedContainer: Container, QueueType, DequeType {}
{'fraction_non_alphanumeric': 0.0847457627118644, 'fraction_numerical': 0.003389830508474576, 'mean_word_length': 2.7715654952076676, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5315894', 'n_tokens_mistral': 634, 'n_tokens_neox': 614, 'n_words': 283}