<commit_before>/*
 *  BSD License (http://lemurproject.org/galago-license)
 */
package org.lemurproject.galago.core.retrieval.query;

import gnu.trove.map.hash.TObjectByteHashMap;
import gnu.trove.map.hash.TObjectDoubleHashMap;
import gnu.trove.map.hash.TObjectLongHashMap;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.*;
import java.util.regex.Pattern;

/**
 * Currently the parameters that are attached to query Nodes are not quite the
 * same implementation as the generic Parameters object. We intend to fold these
 * classes together at some point in the future, most likely making this one a
 * subclass of the Parameters object.
 *
 * For now, however, they are separate.
 *
 *
 * @author sjh
 */
public class NodeParameters implements Serializable {
  private static enum Type {
    STRING, LONG, DOUBLE, MAP, BOOLEAN, LIST
  }

  private HashMap<String, Type> keyMapping = new HashMap<>();
  private HashMap<String, String> stringMap = null;
  private TObjectByteHashMap<String> boolMap = null;
  private TObjectLongHashMap<String> longMap = null;
  private TObjectDoubleHashMap<String> doubleMap = null;
  private static final long serialVersionUID = 4553653651892088433L;

  public static NodeParameters create() { return new NodeParameters(); }
  public NodeParameters() {
    // do nothing
  }

  public NodeParameters(boolean def) {
    set("default", def);
  }

  public NodeParameters(long def) {
    set("default", def);
  }

  public NodeParameters(double def) {
    set("default", def);
  }

  public NodeParameters(String def) {
    set("default", def);<commit_msg>Add clear() method to NodeParameters()<commit_after>/*
 *  BSD License (http://lemurproject.org/galago-license)
 */
package org.lemurproject.galago.core.retrieval.query;

import gnu.trove.map.hash.TObjectByteHashMap;
import gnu.trove.map.hash.TObjectDoubleHashMap;
import gnu.trove.map.hash.TObjectLongHashMap;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.*;
import java.util.regex.Pattern;

/**
 * Currently the parameters that are attached to query Nodes are not quite the
 * same implementation as the generic Parameters object. We intend to fold these
 * classes together at some point in the future, most likely making this one a
 * subclass of the Parameters object.
 *
 * For now, however, they are separate.
 *
 *
 * @author sjh
 */
public class NodeParameters implements Serializable {
  public void clear() {
    keyMapping.clear();
    stringMap = null;
    boolMap = null;
    longMap = null;
    doubleMap = null;
  }

  private static enum Type {
    STRING, LONG, DOUBLE, MAP, BOOLEAN, LIST
  }

  private HashMap<String, Type> keyMapping = new HashMap<>();
  private HashMap<String, String> stringMap = null;
  private TObjectByteHashMap<String> boolMap = null;
  private TObjectLongHashMap<String> longMap = null;
  private TObjectDoubleHashMap<String> doubleMap = null;
  private static final long serialVersionUID = 4553653651892088433L;

  public static NodeParameters create() { return new NodeParameters(); }
  public NodeParameters() {
    // do nothing
  }

  public NodeParameters(boolean def) {
    set("default", def);
  }

  public NodeParameters(long def) {
    set("default", def);
  }

  public NodeParameters(double def) {
    set("default", def);
  }

  public NodeParameters(String def) {
    set("default", def);
{'fraction_non_alphanumeric': 0.10017371163867979, 'fraction_numerical': 0.011001737116386797, 'mean_word_length': 4.2269288956127085, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1922592', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1004, 'n_words': 313}