<commit_before>/*
 * Created on Aug 17, 2005
 */
package uk.org.ponder.rsf.template;

import java.util.HashMap;
import java.util.Iterator;

import uk.org.ponder.stringutil.CharWrap;

public class XMLLumpMMap {
  private HashMap idtolumps = new HashMap(8);
  
  public String getHeadsDebug() {
    CharWrap message = new CharWrap();
    message.append("Heads: (");
    boolean first = true;
    for (Iterator keys = idtolumps.keySet().iterator(); keys.hasNext();) {
      if (!first) {
        message.append(", ");
      }
      message.append((String)keys.next());
      first = false;
    }
    message.append(")");
    return message.toString();
  }
  
  public XMLLumpList headsForID(String ID) {
    XMLLumpList togo = (XMLLumpList) idtolumps.get(ID);
    return togo;
  }
  
  public XMLLumpList headsForIDEnsure(String ID) {
    XMLLumpList togo = (XMLLumpList) idtolumps.get(ID);
    if (togo == null) {
      togo = new XMLLumpList();
      idtolumps.put(ID, togo);
    }
    return togo;
  }

  public boolean hasID(String ID) {
    return idtolumps.get(ID) != null;
  }
  
  /** Returns an iterator of the String values of the IDs represented here.
   */
  public Iterator iterator() {
    return idtolumps.keySet().iterator();
  }
  
  private int concretes = 0;

  public int numConcretes() {
    return concretes;
  }
  
  public void addLump(String ID, XMLLump lump) {
    XMLLumpList list = headsForIDEnsure(ID);
    list.add(lump);
    if (ID.indexOf(XMLLump.TRANSITION_SEPARATOR) == -1) {
      ++ concretes;
    }
  }
  
  public static final String FINAL_SUFFIX = "*final";
  
  public static final boolean isFinal(String totest) {
    return totest.endsWith(FINAL_SUFFIX);
  }
  public void setFinal(String ID, XMLLump lump) {
    idtolumps.put(ID + FINAL_SUFFIX, lump);
  }
  public XMLLump getFinal(String ID) {
    return (XMLLump) idtolumps.get(ID + FINAL_SUFFIX);
  }
}<commit_msg>isSpecial rather than isFinal<commit_after>/*
 * Created on Aug 17, 2005
 */
package uk.org.ponder.rsf.template;

import java.util.HashMap;
import java.util.Iterator;

import uk.org.ponder.stringutil.CharWrap;

public class XMLLumpMMap {
  private HashMap idtolumps = new HashMap(8);
  
  public String getHeadsDebug() {
    CharWrap message = new CharWrap();
    message.append("Heads: (");
    boolean first = true;
    for (Iterator keys = idtolumps.keySet().iterator(); keys.hasNext();) {
      if (!first) {
        message.append(", ");
      }
      message.append((String)keys.next());
      first = false;
    }
    message.append(")");
    return message.toString();
  }
  
  public XMLLumpList headsForID(String ID) {
    XMLLumpList togo = (XMLLumpList) idtolumps.get(ID);
    return togo;
  }
  
  public XMLLumpList headsForIDEnsure(String ID) {
    XMLLumpList togo = (XMLLumpList) idtolumps.get(ID);
    if (togo == null) {
      togo = new XMLLumpList();
      idtolumps.put(ID, togo);
    }
    return togo;
  }

  public boolean hasID(String ID) {
    return idtolumps.get(ID) != null;
  }
  
  /** Returns an iterator of the String values of the IDs represented here.
   */
  public Iterator iterator() {
    return idtolumps.keySet().iterator();
  }
  
  private int concretes = 0;

  public int numConcretes() {
    return concretes;
  }
  
  public void addLump(String ID, XMLLump lump) {
    XMLLumpList list = headsForIDEnsure(ID);
    list.add(lump);
    if (ID.indexOf(XMLLump.TRANSITION_SEPARATOR) == -1) {
      ++ concretes;
    }
  }
  
  public static final String FINAL_SUFFIX = "*final";
  
  public static final boolean isSpecial(String totest) {
    return totest.endsWith(FINAL_SUFFIX) || totest.indexOf(XMLLump.TRANSITION_SEPARATOR) != -1;
  }
  public void setFinal(String ID, XMLLump lump) {
    idtolumps.put(ID + FINAL_SUFFIX, lump);
  }
  public XMLLump getFinal(String ID) {
    return (XMLLump) idtolumps.get(ID + FINAL_SUFFIX);
  }
}
{'fraction_non_alphanumeric': 0.12274832732887288, 'fraction_numerical': 0.004889346371590325, 'mean_word_length': 3.1045406546990497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3513477', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1370, 'n_words': 311}