<commit_before>/*
 * Copyright (C) 2014 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.mafagafogigante.dungeon.commands;

import org.mafagafogigante.dungeon.util.CircularList;
import org.mafagafogigante.dungeon.util.Utils;

import org.jetbrains.annotations.Nullable;

import java.io.Serializable;

/**
 * CommandHistory class that is used to keep track of all the commands issued by the player.
 */
public class CommandHistory implements Serializable {

  private static final int HISTORY_MAXIMUM_SIZE = 200; // Enough. Small so it doesn't slow down 'TAB' search.
  private final CircularList<String> commands = new CircularList<>(HISTORY_MAXIMUM_SIZE);
  private transient Cursor cursor = new Cursor(this);

  /**
   * Returns a CommandHistory.Cursor to provide access to the stored commands.
   */
  public Cursor getCursor() {
    return cursor;
  }

  /**
   * Returns the number of commands in this CommandHistory.
   */
  private int size() {
    return commands.size();
  }

  /**
   * Returns true if this CommandHistory contains no commands.
   */
  private boolean isEmpty() {
    return commands.isEmpty();<commit_msg>CommandHistory needs a readResolve method<commit_after>/*
 * Copyright (C) 2014 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.mafagafogigante.dungeon.commands;

import org.mafagafogigante.dungeon.util.CircularList;
import org.mafagafogigante.dungeon.util.Utils;

import org.jetbrains.annotations.Nullable;

import java.io.Serializable;

/**
 * CommandHistory class that is used to keep track of all the commands issued by the player.
 */
public class CommandHistory implements Serializable {

  private static final int HISTORY_MAXIMUM_SIZE = 200; // Enough. Small so it doesn't slow down 'TAB' search.
  private final CircularList<String> commands = new CircularList<>(HISTORY_MAXIMUM_SIZE);
  private transient Cursor cursor = new Cursor(this);

  private Object readResolve() {
    cursor = new Cursor(this);
    return this;
  }

  /**
   * Returns a CommandHistory.Cursor to provide access to the stored commands.
   */
  public Cursor getCursor() {
    return cursor;
  }

  /**
   * Returns the number of commands in this CommandHistory.
   */
  private int size() {
    return commands.size();
  }

  /**
   * Returns true if this CommandHistory contains no commands.
   */
  private boolean isEmpty() {
    return commands.isEmpty();
{'fraction_non_alphanumeric': 0.07974613686534217, 'fraction_numerical': 0.004415011037527594, 'mean_word_length': 3.738562091503268, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2562623', 'n_tokens_mistral': 1018, 'n_tokens_neox': 986, 'n_words': 417}