<commit_before>var RBTree = require('bintrees').RBTree
var assert = require('assert')
var Operation = require('operation')
var slice = [].slice
var events = require('events')
var util = require('util')

function Scheduler (options) {
    options || (options = {})
    this.what = {}
    this.when = new RBTree(function (a, b) { return a.when - b.when })
    this._timeout = null
    this._Date = options.Date || Date
    this._timer = !('timer' in options) || options.timer
    events.EventEmitter.call(this)
}
util.inherits(Scheduler, events.EventEmitter)

Scheduler.prototype._clear = function () {
    if (this._timer && this._timeout != null) {
        clearTimeout(this._timeout)
        this._timeout = null
    }
}

Scheduler.prototype._set = function () {
    if (this._timer && this._timeout == null && this.next() != null) {
        var now = this._Date.now()
        var timeout = Math.max(0, this.next() - now)
        if (timeout == 0) {
            this._onTimeout()
        } else {
            this._timeout = setTimeout(this._onTimeout.bind(this), timeout)
        }
    }
}

Scheduler.prototype._onTimeout = function () {<commit_msg>Make the whether to set a timer property public.<commit_after>var RBTree = require('bintrees').RBTree
var assert = require('assert')
var Operation = require('operation')
var slice = [].slice
var events = require('events')
var util = require('util')

function Scheduler (options) {
    options || (options = {})
    this.what = {}
    this.when = new RBTree(function (a, b) { return a.when - b.when })
    this._timeout = null
    this._Date = options.Date || Date
    this.setTimeout = !('setTimeout' in options) || options.setTimeout
    events.EventEmitter.call(this)
}
util.inherits(Scheduler, events.EventEmitter)

Scheduler.prototype._clear = function () {
    if (this._timeout != null) {
        clearTimeout(this._timeout)
        this._timeout = null
    }
}

Scheduler.prototype._set = function () {
    if (this.setTimeout && this._timeout == null && this.next() != null) {
        var now = this._Date.now()
        var timeout = Math.max(0, this.next() - now)
        if (timeout == 0) {
            this._onTimeout()
        } else {
            this._timeout = setTimeout(this._onTimeout.bind(this), timeout)
        }
    }
}

Scheduler.prototype._onTimeout = function () {
{'fraction_non_alphanumeric': 0.14615384615384616, 'fraction_numerical': 0.0017094017094017094, 'mean_word_length': 2.8822553897180763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1303292', 'n_tokens_mistral': 701, 'n_tokens_neox': 708, 'n_words': 167}