<commit_before>/*******************************************************************************
* Copyright (c) 2007, 2008, 2012 IBM Corporation & CWI
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*    <NAME> (<EMAIL>) - initial API and implementation
*    <NAME> (<EMAIL>)
*    <NAME> - rational support, labeled maps and tuples
*******************************************************************************/

package org.eclipse.imp.pdb.facts.impl.reference;

import org.eclipse.imp.pdb.facts.IConstructor;
import org.eclipse.imp.pdb.facts.IList;
import org.eclipse.imp.pdb.facts.IListWriter;
import org.eclipse.imp.pdb.facts.IMap;
import org.eclipse.imp.pdb.facts.IMapWriter;
import org.eclipse.imp.pdb.facts.INode;
import org.eclipse.imp.pdb.facts.ISet;
import org.eclipse.imp.pdb.facts.ISetWriter;
import org.eclipse.imp.pdb.facts.ITuple;
import org.eclipse.imp.pdb.facts.IValue;
import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
import org.eclipse.imp.pdb.facts.exceptions.UnexpectedElementTypeException;
import org.eclipse.imp.pdb.facts.impl.primitive.AbstractPrimitiveValueFactory;
import org.eclipse.imp.pdb.facts.type.Type;
import org.eclipse.imp.pdb.facts.type.TypeFactory;

import java.util.Objects;

/**
 * This is a reference implementation for an @{link IValueFactory}. It uses
 * the Java standard library to implement it in a most straightforward but
 * not necessarily very efficient manner.
 */
public class ValueFactory extends AbstractPrimitiveValueFactory {
	private static final ValueFactory sInstance = new ValueFactory();
	public static ValueFactory getInstance() {
		return sInstance;
	}

	private ValueFactory() {
		super();
	}

	protected static void checkNull(Object... args) {
		for (Object a : args) {
			Objects.requireNonNull(a);
		}
	}

	protected static void checkNull(java.util.Map<Object, Object> args) {
		for (java.util.Map.Entry<Object, Object> entry : args.entrySet()) {
			if (entry == null || entry.getKey() == null || entry.getValue() == null) {
				throw new NullPointerException();
			}
		}
	}
<commit_msg>Making constructor protected so that other this class might be extended within the package.<commit_after>/*******************************************************************************
* Copyright (c) 2007, 2008, 2012 IBM Corporation & CWI
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*    <NAME> (<EMAIL>) - initial API and implementation
*    <NAME> (<EMAIL>)
*    <NAME> - rational support, labeled maps and tuples
*******************************************************************************/

package org.eclipse.imp.pdb.facts.impl.reference;

import org.eclipse.imp.pdb.facts.IConstructor;
import org.eclipse.imp.pdb.facts.IList;
import org.eclipse.imp.pdb.facts.IListWriter;
import org.eclipse.imp.pdb.facts.IMap;
import org.eclipse.imp.pdb.facts.IMapWriter;
import org.eclipse.imp.pdb.facts.INode;
import org.eclipse.imp.pdb.facts.ISet;
import org.eclipse.imp.pdb.facts.ISetWriter;
import org.eclipse.imp.pdb.facts.ITuple;
import org.eclipse.imp.pdb.facts.IValue;
import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
import org.eclipse.imp.pdb.facts.exceptions.UnexpectedElementTypeException;
import org.eclipse.imp.pdb.facts.impl.primitive.AbstractPrimitiveValueFactory;
import org.eclipse.imp.pdb.facts.type.Type;
import org.eclipse.imp.pdb.facts.type.TypeFactory;

import java.util.Objects;

/**
 * This is a reference implementation for an @{link IValueFactory}. It uses
 * the Java standard library to implement it in a most straightforward but
 * not necessarily very efficient manner.
 */
public class ValueFactory extends AbstractPrimitiveValueFactory {
	private static final ValueFactory sInstance = new ValueFactory();
	public static ValueFactory getInstance() {
		return sInstance;
	}

	protected ValueFactory() {
		super();
	}

	protected static void checkNull(Object... args) {
		for (Object a : args) {
			Objects.requireNonNull(a);
		}
	}

	protected static void checkNull(java.util.Map<Object, Object> args) {
		for (java.util.Map.Entry<Object, Object> entry : args.entrySet()) {
			if (entry == null || entry.getKey() == null || entry.getValue() == null) {
				throw new NullPointerException();
			}
		}
	}

{'fraction_non_alphanumeric': 0.17498923805424021, 'fraction_numerical': 0.006887645286267757, 'mean_word_length': 4.934865900383142, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1462097', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1329, 'n_words': 351}