<commit_before>import Foundation

// This is the element for listing build configurations.
public struct XCConfigurationList: Isa {
    
    // MARK: - Attributes
    
    public let reference: UUID
    
    public let isa: String = "XCConfigurationList"
    
    public let buildConfigurations: Set<UUID>
    
    public let defaultConfigurationIsVisible: Int = 0
    
    public let defaultConfigurationName: String
    
    // MARK: - Init
    
    public init(reference: UUID,
                buildConfigurations: Set<UUID>,
                defaultConfigurationName: String) {
        self.reference = reference
        self.buildConfigurations = buildConfigurations
        self.defaultConfigurationName = defaultConfigurationName
    }
    
    // MARK: - Public
    
    public func adding(configuration: UUID) -> XCConfigurationList {
        var buildConfigurations = self.buildConfigurations
        buildConfigurations.update(with: configuration)
        return XCConfigurationList(reference: self.reference,
                                   buildConfigurations: buildConfigurations,
                                   defaultConfigurationName: self.defaultConfigurationName)
    }
    
    public func removing(configuration: UUID) -> XCConfigurationList {
        var buildConfigurations = self.buildConfigurations
        if let index = buildConfigurations.index(of: configuration) {
            buildConfigurations.remove(at: index)
        }
        return XCConfigurationList(reference: self.reference,
                                   buildConfigurations: buildConfigurations,
                                   defaultConfigurationName: self.defaultConfigurationName)

    }
    
    public func withDefaultConfigurationName(name: String) -> XCConfigurationList {
        return XCConfigurationList(reference: self.reference,
                                   buildConfigurations: self.buildConfigurations,
                                   defaultConfigurationName: name)
    }
    
}<commit_msg>Make XCConfigurationList conform the ProjectElement protocol and add missing documentation.<commit_after>import Foundation
import Unbox

// This is the element for listing build configurations.
public struct XCConfigurationList: ProjectElement {
    
    // MARK: - Attributes
    
    /// Element reference.
    public let reference: UUID
    
    /// Element isa.
    public let isa: String = "XCConfigurationList"
    
    /// Element build configurations.
    public let buildConfigurations: Set<UUID>
    
    /// Element default configuration is visible.
    public let defaultConfigurationIsVisible: UInt
    
    /// Element default configuration name
    public let defaultConfigurationName: String
    
    // MARK: - Init
    
    /// Initializes the element with its properties.
    ///
    /// - Parameters:
    ///   - reference: element reference.
    ///   - buildConfigurations: element build configurations.
    ///   - defaultConfigurationName: element default configuration name.
    ///   - defaultConfigurationIsVisible: default configuration is visible.
    public init(reference: UUID,
                buildConfigurations: Set<UUID>,
                defaultConfigurationName: String,
                defaultConfigurationIsVisible: UInt = 0) {
        self.reference = reference
        self.buildConfigurations = buildConfigurations
        self.defaultConfigurationName = defaultConfigurationName
        self.defaultConfigurationIsVisible = defaultConfigurationIsVisible
    }
    
    /// Initializes the element with the reference and a dictionary that contains its properties.
    ///
    /// - Parameters:
    ///   - reference: element reference.
    ///   - dictionary: dictionary that contains its properties.
    /// - Throws: an error if any of the attributes is missing or the type is wrong.
    public init(reference: UUID, dictionary: [String : Any]) throws {
        self.reference = reference
        let unboxer = Unboxer(dictionary: dictionary)
        self.buildConfigurations = try unboxer.unbox(key: "buildConfigurations")
        self.defaultConfigurationIsVisible = try unboxer.unbox(key: "defaultConfigurationIsVisible")
        self.defaultConfigurationName = try unboxer.unbox(key: "defaultConfigurationName")
    }
    
    // MARK: - Public
    
    /// Returns a new configuration list adding a configuration.
    ///
    /// - Parameter configuration: refrence to the configuration to be added.
    /// - Returns: new configuration list with the configuration added.
    public func adding(configuration: UUID) -> XCConfigurationList {
        var buildConfigurations = self.buildConfigurations
        buildConfigurations.update(with: configuration)
        return XCConfigurationList(reference: self.reference,
                                   buildConfigurations: buildConfigurations,
                                   defaultConfigurationName: self.defaultConfigurationName)
    }
    
    /// Returns a new configuration list removing a configuration.
    ///
    /// - Parameter configuration: reference to the configuration to be removed.
    /// - Returns: new configuration list with the configuration removed.
    public func removing(configuration: UUID) -> XCConfigurationList {
        var buildConfigurations = self.buildConfigurations
        buildConfigurations.remove(configuration)
        return XCConfigurationList(reference: self.reference,
                                   buildConfigurations: buildConfigurations,
                                   defaultConfigurationName: self.defaultConfigurationName)

    }
    
    public func withDefaultConfigurationName(name: String) -> XCConfigurationList {
        return XCConfigurationList(reference: self.reference,
                                   buildConfigurations: self.buildConfigurations,
                                   defaultConfigurationName: name)
    }
    
    // MARK: - Hashable
    
    public static func == (lhs: XCConfigurationList,
                           rhs: XCConfigurationList) -> Bool {
        return lhs.reference == rhs.reference &&
        lhs.isa == rhs.isa &&
        lhs.buildConfigurations == rhs.buildConfigurations &&
        lhs.defaultConfigurationIsVisible == rhs.defaultConfigurationIsVisible
    }
    
    public var hashValue: Int { return self.reference.hashValue }

}
{'fraction_non_alphanumeric': 0.06811048336472066, 'fraction_numerical': 0.00031387319522912746, 'mean_word_length': 2.3314166231050706, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7369947', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1407, 'n_words': 399}