<commit_before>package interpres;

import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.ListIterator;

import interpres.ast.AST;

public class DefinitionTable {
  private int scopeLevel;
  private LinkedList<Definition> definitions = new LinkedList<Definition>();

  private static class Definition {
    private String id;
    private Object value;
    private int scopeLevel;

    public Definition(String id, Object value, int scopeLevel) {
      this.id = id;
      this.value = value;
      this.scopeLevel = scopeLevel;
    }

    public String getId() { return this.id; }
    public Object getValue() { return this.value; }
    public int getScopeLevel() { return this.scopeLevel; }
  }

  public void define(String name, Object value) {
    int insertionIndex = 0;

    for (int i = this.definitions.size() - 1; i >= 0; i--) {
      if (this.definitions.get(i).getScopeLevel() == 0) {
        insertionIndex = i + 1; break;
      }
    }

    this.definitions.add(insertionIndex, new Definition(name, value, 0));
  }

  public void bind(String name, Object value) {
    this.definitions.addLast(new Definition(name, value, this.scopeLevel));
  }

  public Object lookup(String name) {
    Iterator<Definition> it = this.definitions.descendingIterator();

    while (it.hasNext()) {
      Definition definition = it.next();
      if (definition.getId().equals(name)) return definition.getValue();
    }

    return null;
  }

  public void enterScope() {
    this.scopeLevel++;
  }

  public void leaveScope() {
    Iterator<Definition> it = this.definitions.descendingIterator();

    while (it.hasNext() && it.next().getScopeLevel() == this.scopeLevel) {
      it.remove();
    }

    this.scopeLevel--;
  }
}
<commit_msg>Renamed id to name<commit_after>package interpres;

import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.ListIterator;

import interpres.ast.AST;

public class DefinitionTable {
  private int scopeLevel;
  private LinkedList<Definition> definitions = new LinkedList<Definition>();

  private static class Definition {
    private String name;
    private Object value;
    private int scopeLevel;

    public Definition(String name, Object value, int scopeLevel) {
      this.name = name;
      this.value = value;
      this.scopeLevel = scopeLevel;
    }

    public String getName() { return this.name; }
    public Object getValue() { return this.value; }
    public int getScopeLevel() { return this.scopeLevel; }
  }

  public void define(String name, Object value) {
    int insertionIndex = 0;

    for (int i = this.definitions.size() - 1; i >= 0; i--) {
      if (this.definitions.get(i).getScopeLevel() == 0) {
        insertionIndex = i + 1; break;
      }
    }

    this.definitions.add(insertionIndex, new Definition(name, value, 0));
  }

  public void bind(String name, Object value) {
    this.definitions.addLast(new Definition(name, value, this.scopeLevel));
  }

  public Object lookup(String name) {
    Iterator<Definition> it = this.definitions.descendingIterator();

    while (it.hasNext()) {
      Definition definition = it.next();
      if (definition.getName().equals(name)) return definition.getValue();
    }

    return null;
  }

  public void enterScope() {
    this.scopeLevel++;
  }

  public void leaveScope() {
    Iterator<Definition> it = this.definitions.descendingIterator();

    while (it.hasNext() && it.next().getScopeLevel() == this.scopeLevel) {
      it.remove();
    }

    this.scopeLevel--;
  }
}

{'fraction_non_alphanumeric': 0.12111017661900757, 'fraction_numerical': 0.00336417157275021, 'mean_word_length': 3.2375296912114013, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6335732', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1039, 'n_words': 277}