<commit_before>package org.eclipse.imp.pdb.facts.impl.primitive;

import java.net.URI;
import java.net.URISyntaxException;

import org.eclipse.imp.pdb.facts.impl.primitive.IURI;

/*
 * Not supported: in URI class, scheme is case insensitive, but this is already kinda broken, since on windows & osx, so should path's be.
 */
/*package*/ class SourceLocationURIValues {
	static IURI newURI(URI base) {
		return newURI(base.getScheme(), base.getAuthority(),base.getPath(), base.getQuery(), base.getFragment());
	}
	static IURI newURI(String scheme, String authority, String path, String query, String fragment) {
		if (path != null && !path.startsWith("/")) {
			path = "/" + path;
		}
		if (scheme == null || scheme.equals(""))
			throw new IllegalArgumentException("scheme cannot be empty or null");
		if (authority == null || authority.equals("")) {
			if (path == null || path.equals("/")) {
				if (query == null) {
					if (fragment == null) {
						return new SourceLocationURIValues.BaseURI(scheme);
					}
					return new SourceLocationURIValues.FragmentURI(scheme, fragment);
				}
				if (fragment == null) {
					return new SourceLocationURIValues.QueryURI(scheme, query);
				}
				return new SourceLocationURIValues.FragmentQueryURI(scheme, query, fragment);
			}
			if (query == null) {
				if (fragment == null) {
					return new SourceLocationURIValues.PathURI(scheme, path);
				}
				return new SourceLocationURIValues.FragmentPathURI(scheme, path, fragment);
			}
			if (fragment == null) {
				return new SourceLocationURIValues.QueryPathURI(scheme, path, query);
			}
			return new SourceLocationURIValues.FragmentQueryPathURI(scheme, path, query, fragment);
		}<commit_msg>Extra test case for empty paths<commit_after>package org.eclipse.imp.pdb.facts.impl.primitive;

import java.net.URI;
import java.net.URISyntaxException;

import org.eclipse.imp.pdb.facts.impl.primitive.IURI;

/*
 * Not supported: in URI class, scheme is case insensitive, but this is already kinda broken, since on windows & osx, so should path's be.
 */
/*package*/ class SourceLocationURIValues {
	static IURI newURI(URI base) {
		return newURI(base.getScheme(), base.getAuthority(),base.getPath(), base.getQuery(), base.getFragment());
	}
	static IURI newURI(String scheme, String authority, String path, String query, String fragment) {
		if (path != null) {
			if (path.isEmpty()) {
				path = null;
			}
			else if (!path.startsWith("/")) {
				path = "/" + path;
			}
		}
		if (scheme == null || scheme.equals(""))
			throw new IllegalArgumentException("scheme cannot be empty or null");
		if (authority == null || authority.equals("")) {
			if (path == null || path.equals("/")) {
				if (query == null) {
					if (fragment == null) {
						return new SourceLocationURIValues.BaseURI(scheme);
					}
					return new SourceLocationURIValues.FragmentURI(scheme, fragment);
				}
				if (fragment == null) {
					return new SourceLocationURIValues.QueryURI(scheme, query);
				}
				return new SourceLocationURIValues.FragmentQueryURI(scheme, query, fragment);
			}
			if (query == null) {
				if (fragment == null) {
					return new SourceLocationURIValues.PathURI(scheme, path);
				}
				return new SourceLocationURIValues.FragmentPathURI(scheme, path, fragment);
			}
			if (fragment == null) {
				return new SourceLocationURIValues.QueryPathURI(scheme, path, query);
			}
			return new SourceLocationURIValues.FragmentQueryPathURI(scheme, path, query, fragment);
		}
{'fraction_non_alphanumeric': 0.12935753385191587, 'fraction_numerical': 0.0, 'mean_word_length': 3.96, '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': '3404908', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1014, 'n_words': 283}