<commit_before>package org.data2semantics.mustard.weisfeilerlehman;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Wrapper for a Map from Integer to StringBuilder as labels
 * 
 * @author Gerben
 *
 */
public class MapLabel {
	private StringBuilder[] map;
	private Map<Integer, String> prevNBH;
	private Map<Integer, Boolean> sameAsPrev;
	private Set<Integer> keySet;


	public MapLabel(int mapSize) {
		map = new StringBuilder[mapSize];
		prevNBH = new HashMap<Integer, String>();
		sameAsPrev = new HashMap<Integer, Boolean>();
		keySet = new HashSet<Integer>();
	}


	public MapLabel() {
		this(3);
	}

	public Set<Integer> keySet() {
		return keySet;
	}

	public void put(Integer key, StringBuilder value) {
		if (map[key] == null) {
			keySet.add(key);
		}
		map[key] = value;
	}

	public StringBuilder get(Integer key) {
		return map[key];
	}

	public boolean containsKey(Integer key) {<commit_msg>MapLabel Bugfix<commit_after>package org.data2semantics.mustard.weisfeilerlehman;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Wrapper for a Map from Integer to StringBuilder as labels
 * 
 * @author Gerben
 *
 */
public class MapLabel {
	private StringBuilder[] map;
	private Map<Integer, String> prevNBH;
	private Map<Integer, Boolean> sameAsPrev;
	private Set<Integer> keySet;


	public MapLabel(int mapSize) {
		map = new StringBuilder[mapSize];
		prevNBH = new HashMap<Integer, String>();
		sameAsPrev = new HashMap<Integer, Boolean>();
		keySet = new HashSet<Integer>();
	}


	public MapLabel() {
		this(4);
	}

	public Set<Integer> keySet() {
		return keySet;
	}

	public void put(Integer key, StringBuilder value) {
		if (key >= map.length) {
			StringBuilder[] map2 = new StringBuilder[key+1]; 
			for (int i = 0; i < map.length; i++) {
				map2[i] = map[i];
			}

			map = map2;
		}

		if (map[key] == null) {
			keySet.add(key);
		}
		map[key] = value;
	}

	public StringBuilder get(Integer key) {
		return map[key];
	}

	public boolean containsKey(Integer key) {
{'fraction_non_alphanumeric': 0.1273854961832061, 'fraction_numerical': 0.004293893129770993, 'mean_word_length': 4.0774818401937045, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '379124', 'n_tokens_mistral': 768, 'n_tokens_neox': 703, 'n_words': 191}