<commit_before>package com.dafrito.lua.script;

import java.util.AbstractMap;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

import javax.script.Bindings;
import javax.script.SimpleBindings;

import lua.LuaLibrary;
import lua.LuaLibrary.lua_State;

public class LuaBindings implements Bindings {

	private static final LuaLibrary lua = LuaLibrary.INSTANCE;
	
	private final lua_State state;

	private LuaTranslator translator;

	public LuaBindings(LuaLibrary.lua_State state) {
		this(state, new LuaTranslator());
	}
	
	public LuaBindings(LuaLibrary.lua_State state, LuaTranslator translator) {
		this.state = state;
		this.translator = translator;
	}
	
	@Override
	public Set<java.util.Map.Entry<String, Object>> entrySet() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean containsKey(Object key) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Object get(Object key) {
		if(key == null) {
			throw new NullPointerException("key must not be null");
		}
		// TODO: This method pollutes the stack if it fails.
		this.translator.toLua(state, key);
		lua.lua_gettable(state, LuaLibrary.LUA_GLOBALSINDEX);
		return this.translator.fromLua(state, 1);
	}

	@Override
	public Object put(String name, Object value) {
		if(name == null) {
			throw new NullPointerException("key must not be null");
		}
		Object old = this.get(name);
		// TODO: This method pollutes the stack if it fails.
		this.translator.toLua(state, name);
		this.translator.toLua(state, value);
		lua.lua_settable(state, LuaLibrary.LUA_GLOBALSINDEX);
		return old;
	}

	@Override
	public void putAll(Map<? extends String, ? extends Object> toMerge) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Object remove(Object key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void clear() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean containsValue(Object value) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isEmpty() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override<commit_msg>Outsourced some methods to AbstractMap<commit_after>package com.dafrito.lua.script;

import java.util.AbstractMap;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

import javax.script.Bindings;
import javax.script.SimpleBindings;

import lua.LuaLibrary;
import lua.LuaLibrary.lua_State;

public class LuaBindings extends AbstractMap<String, Object> implements Bindings {

	private static final LuaLibrary lua = LuaLibrary.INSTANCE;
	
	private final lua_State state;

	private LuaTranslator translator;

	public LuaBindings(LuaLibrary.lua_State state) {
		this(state, new LuaTranslator());
	}
	
	public LuaBindings(LuaLibrary.lua_State state, LuaTranslator translator) {
		this.state = state;
		this.translator = translator;
	}
	
	@Override
	public Set<java.util.Map.Entry<String, Object>> entrySet() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean containsKey(Object key) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Object get(Object key) {
		if(key == null) {
			throw new NullPointerException("key must not be null");
		}
		// TODO: This method pollutes the stack if it fails.
		this.translator.toLua(state, key);
		lua.lua_gettable(state, LuaLibrary.LUA_GLOBALSINDEX);
		return this.translator.fromLua(state, 1);
	}

	@Override
	public Object put(String name, Object value) {
		if(name == null) {
			throw new NullPointerException("key must not be null");
		}
		Object old = this.get(name);
		// TODO: This method pollutes the stack if it fails.
		this.translator.toLua(state, name);
		this.translator.toLua(state, value);
		lua.lua_settable(state, LuaLibrary.LUA_GLOBALSINDEX);
		return old;
	}

	@Override
	public void clear() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean containsValue(Object value) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.0004926108374384236, 'mean_word_length': 4.166666666666667, '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': '3215179', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1304, 'n_words': 358}