<commit_before>/*
 * Java core library component.
 *
 * Copyright (c) 1997, 1998
 *      Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

package java.lang;


final public class Long
  extends Number
{
	private long value;
	final public static long MIN_VALUE = 0x8000000000000000L;
	final public static long MAX_VALUE = 0x7fffffffffffffffL;
	final public static Class TYPE = Class.getPrimitiveClass("long");

public Long(String s) throws NumberFormatException {
	this(valueOf(s).intValue());
}

public Long(long value) {
	this.value=value;
}

public double doubleValue() {
	return (double )value;
}

public boolean equals(Object obj) {
	if ((obj!=null) && (obj instanceof Long)) {
		return (this.longValue()==((Long )obj).longValue());
	}
	else {
		return false;
	}
}

public float floatValue() {
	return (float )value;
}

public static Long getLong(String nm) {
	return getLong(nm, (Long )null);
}

public static Long getLong(String nm, Long val) {
	String arg;

	if (val==null) arg=null; else arg=val.toString();

	String property=System.getProperty(nm, arg);
	if (property==null) return val;
	else {
		String toParse;
		int radixToParse;

		/* Exception rules in the definition */

		if (property.startsWith("0x-")) return val;
		if (property.startsWith("#-")) return val;
		if (property.endsWith("l") || property.endsWith("L")) return val;

		if (property.startsWith("0x")) {
			toParse=property.substring(2);
			radixToParse=16;
		}
		else if (property.startsWith("#")) {
			toParse=property.substring(1);
			radixToParse=16;
		}
		else if (property.startsWith("0")) {
			toParse=property.substring(1);
			radixToParse=8;
		}
		else {
			toParse=property;
			radixToParse=10;
		}

		if (toParse.length()==0) {
			return val;
		}
		else {
			try {
				return Long.valueOf(toParse, radixToParse);
			}
			catch (NumberFormatException e1) {
				return val;
			}
		}
	}
}

public static Long getLong(String nm, long val) {
	return getLong(nm, new Long(val));
}

public int hashCode() {
	return this.intValue();
}

public int intValue() {
	return (int )value;	
}

public long longValue() {
	return value;
}

public static long parseLong(String s) throws NumberFormatException {
	return parseLong(s, 10);
}

public static long parseLong(String s, int radix) {
	if (s.length()<=0) throw new NumberFormatException();

	/* Check for negativity */
	if (s.charAt(0)=='-') {
		return parseLong(s.substring(1))*-1;
	}
	else {
		long result=0;
		int position;

		for (position=0; position<s.length(); position++) {
			int digit=Character.digit(s.charAt(position), radix);
			if (digit==-1) throw new NumberFormatException();

			result=(result*radix)+digit;
		}

		return result;
	}			
}

private static String toUnsignedString(long i, int bits) {
	if (i == 0) {
		return ("0");
	}

	StringBuffer buf = new StringBuffer();
	long radix = 1 << bits, mask = radix-1;
	while (i != 0) {
		char digit = Character.forDigit((int)(i & mask), (int)radix);
		i >>>= bits;
		buf.append(digit);
	}
	buf.reverse();
	return (buf.toString());
}

public static String toBinaryString ( long i ) {
	return toUnsignedString(i, 1);
}

public static String toHexString ( long i ) {
	return toUnsignedString(i, 4);
}

public static String toOctalString ( long i ) {
	return toUnsignedString(i, 3);
}

public String toString() {
	return toString(this.longValue());<commit_msg>use ints instead of longs; slightly better way of doing previous patch<commit_after>/*
 * Java core library component.
 *
 * Copyright (c) 1997, 1998
 *      Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

package java.lang;


final public class Long
  extends Number
{
	private long value;
	final public static long MIN_VALUE = 0x8000000000000000L;
	final public static long MAX_VALUE = 0x7fffffffffffffffL;
	final public static Class TYPE = Class.getPrimitiveClass("long");

public Long(String s) throws NumberFormatException {
	this(valueOf(s).intValue());
}

public Long(long value) {
	this.value=value;
}

public double doubleValue() {
	return (double )value;
}

public boolean equals(Object obj) {
	if ((obj!=null) && (obj instanceof Long)) {
		return (this.longValue()==((Long )obj).longValue());
	}
	else {
		return false;
	}
}

public float floatValue() {
	return (float )value;
}

public static Long getLong(String nm) {
	return getLong(nm, (Long )null);
}

public static Long getLong(String nm, Long val) {
	String arg;

	if (val==null) arg=null; else arg=val.toString();

	String property=System.getProperty(nm, arg);
	if (property==null) return val;
	else {
		String toParse;
		int radixToParse;

		/* Exception rules in the definition */

		if (property.startsWith("0x-")) return val;
		if (property.startsWith("#-")) return val;
		if (property.endsWith("l") || property.endsWith("L")) return val;

		if (property.startsWith("0x")) {
			toParse=property.substring(2);
			radixToParse=16;
		}
		else if (property.startsWith("#")) {
			toParse=property.substring(1);
			radixToParse=16;
		}
		else if (property.startsWith("0")) {
			toParse=property.substring(1);
			radixToParse=8;
		}
		else {
			toParse=property;
			radixToParse=10;
		}

		if (toParse.length()==0) {
			return val;
		}
		else {
			try {
				return Long.valueOf(toParse, radixToParse);
			}
			catch (NumberFormatException e1) {
				return val;
			}
		}
	}
}

public static Long getLong(String nm, long val) {
	return getLong(nm, new Long(val));
}

public int hashCode() {
	return this.intValue();
}

public int intValue() {
	return (int )value;	
}

public long longValue() {
	return value;
}

public static long parseLong(String s) throws NumberFormatException {
	return parseLong(s, 10);
}

public static long parseLong(String s, int radix) {
	if (s.length()<=0) throw new NumberFormatException();

	/* Check for negativity */
	if (s.charAt(0)=='-') {
		return parseLong(s.substring(1))*-1;
	}
	else {
		long result=0;
		int position;

		for (position=0; position<s.length(); position++) {
			int digit=Character.digit(s.charAt(position), radix);
			if (digit==-1) throw new NumberFormatException();

			result=(result*radix)+digit;
		}

		return result;
	}			
}

private static String toUnsignedString(long i, int bits) {
	if (i == 0) {
		return ("0");
	}

	StringBuffer buf = new StringBuffer();
	int radix = 1 << bits, mask = radix-1;
	while (i != 0) {
		char digit = Character.forDigit(((int)i) & mask, radix);
		i >>>= bits;
		buf.append(digit);
	}
	buf.reverse();
	return (buf.toString());
}

public static String toBinaryString ( long i ) {
	return toUnsignedString(i, 1);
}

public static String toHexString ( long i ) {
	return toUnsignedString(i, 4);
}

public static String toOctalString ( long i ) {
	return toUnsignedString(i, 3);
}

public String toString() {
	return toString(this.longValue());
{'fraction_non_alphanumeric': 0.13915671319614334, 'fraction_numerical': 0.016980860555475607, 'mean_word_length': 4.065597667638484, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '4610152', 'n_tokens_mistral': 2589, 'n_tokens_neox': 2350, 'n_words': 654}