<commit_before>package org.timepedia.chronoscope.client;

import org.timepedia.chronoscope.client.data.DatasetFactory;
import org.timepedia.chronoscope.client.data.MipMapStrategy;
import org.timepedia.chronoscope.client.util.ArgChecker;

import java.util.HashMap;
import java.util.Map;

/**
 * Factory for obtaining a family of components that are tied to a given version 
 * of Chronoscope (i.e. the free vs. the commercial version). 
 * 
 * @author <NAME>
 */
public abstract class ComponentFactory {
  private static ComponentFactory singleton = new ChronoscopeComponentFactory();
  private static boolean componentFactoryAlreadyAssigned = false;
  
  protected Map<String,MipMapStrategy> name2mipmapStrategy = 
    new HashMap<String,MipMapStrategy>();

  protected ComponentFactory() {}
  
  /**
   * Obtains a singleton instance of this factory.
   */
  public static final ComponentFactory get() {
    if (singleton == null) {
      throw new IllegalStateException("FactoryLookup singleton object not assigned");
    }
    return singleton;
  }
  
  public abstract DatasetFactory getDatasetFactory();
  
  public final MipMapStrategy getMipMapStrategy(String name) {
    //GWT.log("TESTING: ComponentFactory: available mipmap strategies: " + name2mipmapStrategy.keySet(), null);
    MipMapStrategy mms = name2mipmapStrategy.get(name);
    if (mms == null) {
      throw new IllegalArgumentException("Can't find MipMapStrategy associated with " +
          "name '" + name + "'");
    }
    return mms;
  }
  
  public static void setComponentFactoryImpl(ComponentFactory factory) {
    ArgChecker.isNotNull(factory, "factory");
    
    // Only allow ComponentFactory to be set once
    if (componentFactoryAlreadyAssigned) {
      throw new IllegalStateException("ComponentFactory instance already set");
    }
    
    componentFactoryAlreadyAssigned = true;
    singleton = factory;
  }
}<commit_msg>Remove double-assignment check<commit_after>package org.timepedia.chronoscope.client;

import org.timepedia.chronoscope.client.data.DatasetFactory;
import org.timepedia.chronoscope.client.data.MipMapStrategy;
import org.timepedia.chronoscope.client.util.ArgChecker;

import java.util.HashMap;
import java.util.Map;

/**
 * Factory for obtaining a family of components that are tied to a given version 
 * of Chronoscope (i.e. the free vs. the commercial version). 
 * 
 * @author <NAME>
 */
public abstract class ComponentFactory {
  private static ComponentFactory singleton = new ChronoscopeComponentFactory();
  private static boolean componentFactoryAlreadyAssigned = false;
  
  protected Map<String,MipMapStrategy> name2mipmapStrategy = 
    new HashMap<String,MipMapStrategy>();

  protected ComponentFactory() {}
  
  /**
   * Obtains a singleton instance of this factory.
   */
  public static final ComponentFactory get() {
    if (singleton == null) {
      throw new IllegalStateException("FactoryLookup singleton object not assigned");
    }
    return singleton;
  }
  
  public abstract DatasetFactory getDatasetFactory();
  
  public final MipMapStrategy getMipMapStrategy(String name) {
    //GWT.log("TESTING: ComponentFactory: available mipmap strategies: " + name2mipmapStrategy.keySet(), null);
    MipMapStrategy mms = name2mipmapStrategy.get(name);
    if (mms == null) {
      throw new IllegalArgumentException("Can't find MipMapStrategy associated with " +
          "name '" + name + "'");
    }
    return mms;
  }
  
  public static void setComponentFactoryImpl(ComponentFactory factory) {
    ArgChecker.isNotNull(factory, "factory");
    
    // Only allow ComponentFactory to be set once
//    if (componentFactoryAlreadyAssigned) {
//      throw new IllegalStateException("ComponentFactory instance already set");
//    }
    
//    componentFactoryAlreadyAssigned = true;
    singleton = factory;
  }
}
{'fraction_non_alphanumeric': 0.09072004159085001, 'fraction_numerical': 0.0015596568754873928, 'mean_word_length': 4.023498694516971, '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': '3143920', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1048, 'n_words': 286}