<commit_before>//
//  Pagination.swift
//  MastodonKit
//
//  Created by Ornithologist Coder on 6/1/17.
//  Copyright © 2017 MastodonKit. All rights reserved.
//

import Foundation

public struct Pagination {
    /// The request range for fetching the next page.
    public let next: RequestRange?
    /// The request range for fetching the previous page.
    public let previous: RequestRange?
}

extension Pagination {
    init(string: String) {
        let links = string
            .components(separatedBy: ",")
            .flatMap(PaginationItem.init)

        var nextLink: RequestRange?
        var previousLink: RequestRange?

        for link in links {
            switch link.type {
            case .next: nextLink = .max(id: link.id, limit: link.limit)
            case .prev: previousLink = .since(id: link.id, limit: link.limit)
            }
        }

        self.next = nextLink
        self.previous = previousLink
    }
}

extension Pagination: Equatable {
    public static func == (lhs: Pagination, rhs: Pagination) -> Bool {
        guard lhs.next == rhs.next, lhs.previous == rhs.previous else { return false }
        return true
    }
}
<commit_msg>Adds MARK for Equatable<commit_after>//
//  Pagination.swift
//  MastodonKit
//
//  Created by Ornithologist Coder on 6/1/17.
//  Copyright © 2017 MastodonKit. All rights reserved.
//

import Foundation

public struct Pagination {
    /// The request range for fetching the next page.
    public let next: RequestRange?
    /// The request range for fetching the previous page.
    public let previous: RequestRange?
}

extension Pagination {
    init(string: String) {
        let links = string
            .components(separatedBy: ",")
            .flatMap(PaginationItem.init)

        var nextLink: RequestRange?
        var previousLink: RequestRange?

        for link in links {
            switch link.type {
            case .next: nextLink = .max(id: link.id, limit: link.limit)
            case .prev: previousLink = .since(id: link.id, limit: link.limit)
            }
        }

        self.next = nextLink
        self.previous = previousLink
    }
}

// MARK: - Equatable

extension Pagination: Equatable {
    public static func == (lhs: Pagination, rhs: Pagination) -> Bool {
        guard lhs.next == rhs.next, lhs.previous == rhs.previous else { return false }
        return true
    }
}

{'fraction_non_alphanumeric': 0.09966499162479062, 'fraction_numerical': 0.006700167504187605, 'mean_word_length': 2.1517150395778364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7540167', 'n_tokens_mistral': 720, 'n_tokens_neox': 681, 'n_words': 215}