<commit_before>/**
 * Created by dmitri on 12/21/2016.
 */
'use strict';

class Process
{
  constructor(obj = {})
  {
    const prd = obj.data || {};
    const msg = obj.message || obj;
    this._prdStack = Array.isArray(prd) ? [...prd] : [prd];
    this._msgStack = Array.isArray(msg) ? [...msg] : [msg];
    this._isAlive = true;
    Reflect.defineProperty(this, 'id', {value:Symbol()});
  }

  get isAlive()
  {
    return this._isAlive;
  }

  end()
  {
    this._isAlive = false;
  }

  get data()
  {
    const len = this._prdStack.length;
    return len ? this._prdStack[len - 1] : undefined;
  }

  getData(offset = 0)
  {
    const len = this._prdStack.length - offset;
    return len > 0 ? this._prdStack[len - 1] : undefined;
  }

  pushData(obj = {})
  {
    this._prdStack.push(obj);
    return obj;
  }

  popData()
  {
    return this._prdStack.pop();
  }

  get message()
  {
    const len = this._msgStack.length;
    return len ? this._msgStack[len - 1] : undefined;
  }

  getMsg(offset = 0)
  {
    const len = this._msgStack.length - offset;
    return len > 0 ? this._msgStack[len - 1] : undefined;
  }

  pushMsg(obj = {})
  {
    this._msgStack.push(obj);
    return obj;
  }

  popMsg()
  {
    return this._msgStack.pop();
  }
}

export default Process;<commit_msg>feat(process): Added clone functionality<commit_after>/**
 * Created by dmitri on 12/21/2016.
 */
'use strict';

class Process
{
  constructor(obj = {})
  {
    const prd = obj.data || {};
    const msg = obj.message || obj;
    this._prdStack = Array.isArray(prd) ? [...prd] : [prd];
    this._msgStack = Array.isArray(msg) ? [...msg] : [msg];
    this._isAlive = true;
    Reflect.defineProperty(this, 'id', {value:Symbol()});
  }

  get isAlive()
  {
    return this._isAlive;
  }

  end()
  {
    this._isAlive = false;
  }

  get data()
  {
    const len = this._prdStack.length;
    return len ? this._prdStack[len - 1] : undefined;
  }

  getData(offset = 0)
  {
    const len = this._prdStack.length - offset;
    return len > 0 ? this._prdStack[len - 1] : undefined;
  }

  pushData(obj = {})
  {
    this._prdStack.push(obj);
    return obj;
  }

  popData()
  {
    return this._prdStack.pop();
  }

  get message()
  {
    const len = this._msgStack.length;
    return len ? this._msgStack[len - 1] : undefined;
  }

  getMsg(offset = 0)
  {
    const len = this._msgStack.length - offset;
    return len > 0 ? this._msgStack[len - 1] : undefined;
  }

  pushMsg(obj = {})
  {
    this._msgStack.push(obj);
    return obj;
  }

  popMsg()
  {
    return this._msgStack.pop();
  }

  clone()
  {
    return new Process({data:this._prdStack, message:this._msgStack});
  }
}

export default Process;
{'fraction_non_alphanumeric': 0.1589477584290478, 'fraction_numerical': 0.011856243052982586, 'mean_word_length': 2.443877551020408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '454478', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1010, 'n_words': 205}