<commit_before>//
//  Timer.swift
//  Apex
//
//  Created by <NAME> on 4/5/18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import Foundation

class Timer: Subscription {
	init(duration: TimeInterval, action: @escaping @autoclosure () -> Action) {
		self.duration = duration
		self.action = action
	}

	func launch(dispatcher: Dispatcher) {
		canceled = false
		DispatchQueue.main.asyncAfter(deadline: .now() + duration) { [weak self] in
			guard let this = self else { return }
			if !this.canceled {
				dispatcher.dispatch(action: this.action())
			}
		}
	}

	func cancel() {
		canceled = true
	}

	var hashValue: Int {
		return duration.hashValue
	}

	static func ==(lhs: Timer, rhs: Timer) -> Bool {
		return lhs.duration == rhs.duration
	}

	let duration: TimeInterval
	let action: () -> Action
	var canceled: Bool = false
}<commit_msg>Add access controls to Timer.<commit_after>//
//  Timer.swift
//  Apex
//
//  Created by <NAME> on 4/5/18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import Foundation

public
class Timer: Subscription {
	public
	init(duration: TimeInterval, action: @escaping @autoclosure () -> Action) {
		self.duration = duration
		self.action = action
	}

	public
	func launch(dispatcher: Dispatcher) {
		canceled = false
		DispatchQueue.main.asyncAfter(deadline: .now() + duration) { [weak self] in
			guard let this = self else { return }
			if !this.canceled {
				dispatcher.dispatch(action: this.action())
			}
		}
	}

	public
	func cancel() {
		canceled = true
	}

	public
	var hashValue: Int {
		return duration.hashValue
	}

	public
	static func ==(lhs: Timer, rhs: Timer) -> Bool {
		return lhs.duration == rhs.duration
	}

	private let duration: TimeInterval
	private let action: () -> Action
	private var canceled: Bool = false
}
{'fraction_non_alphanumeric': 0.12688652878703185, 'fraction_numerical': 0.008943543879262158, 'mean_word_length': 3.2018779342723005, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '4391517', 'n_tokens_mistral': 664, 'n_tokens_neox': 587, 'n_words': 173}