<commit_before>package ndfs.mcndfs_alg3;

import java.util.HashMap;

import graph.State;

/*
 * This class is very much like a hashmap, but it acts as if all keys not present
 * in the hashmap actually are, having value defaultValue, which can only be set
 * at construction of this object  
 */
public class MapWithDefaultValues<KeyType, ValueType>{

  private HashMap<KeyType, ValueType> hashMap;
  private ValueType defaultValue;

  MapWithDefaultValues(HashMap<KeyType, ValueType> hashMap, ValueType defaultValue){
    this.hashMap = hashMap;
    this.defaultValue = defaultValue;
  }

  // TODO: make const method
  ValueType getValue(KeyType key){
    return this.hashMap.get(key);
  }

  /* returns true if either
   * - (key,value) pair is in hashmap
   * - (key,value) pair is not in hashmap AND the requested value is the default value 
   */
  boolean hasKeyValuePair(KeyType key,ValueType value){
    ValueType v = getValue(key);
    if(v==null){
      return v.equals(defaultValue);
    }
    return v.equals(value);
  }


  synchronized void setValueSynchronized(KeyType key,ValueType value){
    hashMap.put(key,value);
  }

  void setValue(KeyType key,ValueType value){
    hashMap.put(key,value);
  }

}<commit_msg>uncommited changes<commit_after>package ndfs.mcndfs_alg3;

import java.util.HashMap;

import graph.State;

/*
 * This class is very much like a hashmap, but it acts as if all keys not present
 * in the hashmap actually are, having value defaultValue, which can only be set
 * at construction of this object  
 */
public class MapWithDefaultValues<KeyType, ValueType>{

  private HashMap<KeyType, ValueType> hashMap;
  private ValueType defaultValue;

  MapWithDefaultValues(HashMap<KeyType, ValueType> hashMap, ValueType defaultValue){
    this.hashMap = hashMap;
    this.defaultValue = defaultValue;
  }

  // TODO: make const method
  ValueType getValue(KeyType key){
    return this.hashMap.get(key);
  }

  /* returns true if either
   * - (key,value) pair is in hashmap
   * - (key,value) pair is not in hashmap AND the requested value is the default value 
   */
  boolean hasKeyValuePair(KeyType key,ValueType value){
    ValueType v = getValue(key);
    if(v==null){
      return value.equals(defaultValue);
    }
    return v.equals(value);
  }


  synchronized void setValueSynchronized(KeyType key,ValueType value){
    hashMap.put(key,value);
  }

  void setValue(KeyType key,ValueType value){
    hashMap.put(key,value);
  }

}
{'fraction_non_alphanumeric': 0.09138697937727457, 'fraction_numerical': 0.0008087343307723412, 'mean_word_length': 3.850980392156863, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6532487', 'n_tokens_mistral': 768, 'n_tokens_neox': 758, 'n_words': 233}