<commit_before>/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2018, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
import {
  IIterator, IterableOrArrayLike, iterItems, once, toArray, toObject
} from '@phosphor/algorithm';

import {
  TreeMap
} from '@phosphor/collections';

import {
  ReadonlyJSONValue
} from '@phosphor/coreutils';

import {
  CRDTUtils
} from './crdtutils';

import {
  DataStoreInternal
} from './datastoreinternal';

import {
  IList
} from './list'


/**
 * The concrete implementation of the `IList` data store object.
 *
 * #### Notes
 * This class is an implementation detail and is subject to change
 * without notice. This is not a public API. I mean it. Really.
 */
export
class ListInternal<T extends ReadonlyJSONValue> implements IList<T> {
  /**
   * Create a new internal list.
   *
   * @param store - The internal data store which owns the list.
   *
   * @param id - The globally unique identifier for the list.
   *
   * @param snapshot - The initial internal snapshot for the list.
   */
  static create<U extends ReadonlyJSONValue>(store: DataStoreInternal, id: string, snapshot: DataStoreInternal.ListSnapshot<U>): ListInternal<U> {
    let list = new ListInternal<U>(store, id);
    list._map.update(iterItems(snapshot));
    return list;
  }

  /**
   * Get an internal snapshot of the current list state.
   *
   * @returns A new internal snapshot of the list state.
   */
  static snapshot<U extends ReadonlyJSONValue>(list: ListInternal<U>): DataStoreInternal.ListSnapshot<U> {
    return toObject(list._map);
  }

  /**
   * Apply a remotely generated system change to an internal list.
   *
   * @param list - The internal list to modify.
   *
   * @param change - The broadcast change to apply to the list.
   */
  static update<U extends ReadonlyJSONValue>(list: ListInternal<U>, change: DataStoreInternal.BroadcastListChange<U>): void {
    // TODO
  }

  /**<commit_msg>fix docs<commit_after>/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2018, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
import {
  IIterator, IterableOrArrayLike, iterItems, once, toArray, toObject
} from '@phosphor/algorithm';

import {
  TreeMap
} from '@phosphor/collections';

import {
  ReadonlyJSONValue
} from '@phosphor/coreutils';

import {
  CRDTUtils
} from './crdtutils';

import {
  DataStoreInternal
} from './datastoreinternal';

import {
  IList
} from './list'


/**
 * The concrete implementation of the `IList` data store object.
 *
 * #### Notes
 * This class is an implementation detail and is subject to change
 * without notice. This is not a public API. I mean it. Really.
 */
export
class ListInternal<T extends ReadonlyJSONValue> implements IList<T> {
  /**
   * Create a new internal list.
   *
   * @param store - The internal data store which owns the list.
   *
   * @param id - The globally unique identifier for the list.
   *
   * @param snapshot - The initial internal snapshot for the list.
   *
   * @returns A new internal list with the given initial state.
   */
  static create<U extends ReadonlyJSONValue>(store: DataStoreInternal, id: string, snapshot: DataStoreInternal.ListSnapshot<U>): ListInternal<U> {
    let list = new ListInternal<U>(store, id);
    list._map.update(iterItems(snapshot));
    return list;
  }

  /**
   * Get an internal snapshot of the current list state.
   *
   * @param list - The internal list of interest.
   *
   * @returns A new internal snapshot of the list state.
   */
  static snapshot<U extends ReadonlyJSONValue>(list: ListInternal<U>): DataStoreInternal.ListSnapshot<U> {
    return toObject(list._map);
  }

  /**
   * Apply a broadcasted change to an internal list.
   *
   * @param list - The internal list to modify.
   *
   * @param change - The broadcasted change to apply to the list.
   */
  static update<U extends ReadonlyJSONValue>(list: ListInternal<U>, change: DataStoreInternal.BroadcastListChange<U>): void {
    // TODO
  }

  /**
{'fraction_non_alphanumeric': 0.16610474263879524, 'fraction_numerical': 0.004045853000674309, 'mean_word_length': 2.6208299430431246, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '5380744', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1215, 'n_words': 434}