<commit_before>/**
 * Rajah.Timer
 *
 */
var RajahQue = [];

function RajahTimer_Clear() {
  RajahQue = [];
}

function RajahTimer_Execute() {
  var i, l, f;
  
  while (RajahQue.length > 0) {
    l=RajahQue.length;
    i=0;
    for (i=0; i<l; i++) {
      f = RajahQue.shift();
      f.func();
    }
  }
}

var setTimeout = function (f, t) {

  RajahQue.push({func: f});
  return RajahQue.length;
//  Utilities.sleep(t);
//  try {
//    f();
//  } catch (e) {
//    ;
//  }
};

var clearTimeout = function () {};

var setInterval = function () {};

var clearInterval = function () {};


<commit_msg>writing dummyTimer, instead of Timer.<commit_after>/**
 * Rajah.dummyTimer
 *
 */
var RajahQue = [];

function RajahTimer_Clear() {
  RajahQue = [];
}

function RajahTimer_Execute() {
  var i, l, f;
  
  while (RajahQue.length > 0) {
    l=RajahQue.length;
    i=0;
    for (i=0; i<l; i++) {
      f = RajahQue.shift();
      f.func();
    }
  }
}

var setTimeout = function (f, t) {

  RajahQue.push({func: f});
  return RajahQue.length;
};

var clearTimeout = function (id) {};

var setInterval = function (f, t) {};

var clearInterval = function (id) {};


Rajah.dummyTimer = (function () {

  var timerQue =[];
  var idCounter = 0;

  var clear = function () {
    timerQue.length = 0;
    // idCounter is NOT initialised here.
    // That's for keeping id unique, although after timer cleared.
  };

  var execute = function () {
    
    var now = new Date();

    // while task exists,
    while (timerQue.length > 0) {

      if (timerQue[0].time <= now) {
        timerQue[0].func();
        if (timerQue[0].t > 0) {
          // Re-entry (id, func, t)
          ;
        }
        timerQue.shift();   // delete entry that has been called.

      } else {
        // wait a while;
        sleep(timerQue[0].time - now);
      }
    }
  };
  
  var setTimeout = function (func, t) {
  
    var id = idCounter++;
  
    // not push. into order
    timerQue.push({
      id:       id,
      func:     func,
      time:     t + now,    // now should replace with like 'new Date'
      interval: 0
    });

    return id;
  };
  
  var clearTimeout = function () {};
  

  var setInterval = function (func, t) {

    if (t <= 0) {
      return -1;    // Error: t should be ' > 0 '
    }

    var id = idCounter++;
  
    // not push. into order
    timerQue.push({
      id:       id,
      func:     func,
      time:     t + now,    // now should replace with like 'new Date'
      interval: t
    });

    return id;
  };
  
  var clearInterval = function () {};

  
  var exports = {
    clear:          clear,
    execute:        execute,

    setTimeout:     setTimeout,
    clearTimeout:   clearTimeout,
    setInterval:    setInterval,
    clearInterval:  clearInterval,
  };
  return exports;

})();
{'fraction_non_alphanumeric': 0.152506221116246, 'fraction_numerical': 0.006398862424457874, 'mean_word_length': 1.9343065693430657, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '6761258', 'n_tokens_mistral': 996, 'n_tokens_neox': 977, 'n_words': 256}