<commit_before>package com.example;

import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/* 34567890123456789012345678901234567890123456789012345678901234567890123456789
 * *****************************************************************************
 * Copyright (c) 2010, M-PLIFY S.A.
 *                     68, avenue de la Liberté
 *                     L-1930 Luxembourg
 *
 * Released by M-PLIFY S.A. under the MIT License  
 *******************************************************************************
 *******************************************************************************
 * Function for checking arguments of a method (or more generally doing
 * assert-like checks) and throwing accordingly.
 * 
 * This is practically the same as Guava's "Preconditions", see
 * 
 *    http://code.google.com/p/guava-libraries/wiki/PreconditionsExplained
 * 
 * But with methods for additional functionality.
 * 
 * For more complete approaches, see: 
 * 
 *    http://en.wikipedia.org/wiki/Design_by_contract
 *
 *    ...for Java and Groovy DbC facilities.
 *
 * What is being thrown 
 * --------------------
 * 
 * These functions throw "CheckFailedException" derived from RuntimeException
 * instead of "NullPointerException", "IllegalArgumentException" and
 * "IllegalStateException".
 *
 * Why: 
 * ----
 * 
 * "IllegalArgumentException" is meant to be thrown
 * during argument checks ("Thrown to indicate that a method has been passed 
 * an illegal or inappropriate argument."), but this is not consistently used.
 * 
 * "IllegalStateException" is meant to be thrown if the "state is incorrect".
 * ("Signals that a method has been invoked at an illegal or inappropriate 
 *  time. In other words, the Java environment or Java application is not
 *  in an appropriate state for the requested operation."), but this is not 
 * consistently used either.
 *  
 * As one is never sure whether "IllegalArgumentException" or
 * "IllegalStateException" should be thrown, just throw "CheckFailedException".
 * 
 * "NullPointerException" should mean that there is some uncaught problem
 * in resolving a reference, it should really not be thrown by methods that
 * check whether a reference is null.  
 *
 * Basically, I would like to see the three above only thrown from the default
 * Java libraries, and possibly third part libraries not from my own code.
 * 
 * How to import
 * -------------
 * 
 * Import this class statically:
 * 
 * import com.example.areyousure.AreYouSure.*
 * 
 * --------------
 * 2010.11.25 - Created because bored to add multiliners to methods entries
 * 2011.02.16 - Added _isInstanceOf() taking multiple parameters
 * 2011.05.30 - Added _cannotHappen()
 * 2011.05.31 - Now throw CheckFailedException instead of IllegalArgumentException.
 *              Some rewrites and renames.
 * 2011.06.16 - Added fail()   
 * 2011.07.12 - formatForMe() has been moved to LogFacilities           
 * 2011.10.19 - Moved the package com.mplify.checkers to "01_ignition"
 *              because it's really used "very early".
 * 2011.11.29 - Added validate() to unify validation calls  
 * 2012.01.18 - In validateIt(): made sure that unreachable validate method
 *              does not throw up the stack     
 * 2012.07.17 - Added inRange() for longs
 * 2012.12.28 - Added NEVER_GET_HERE_BUT_NEEDED_FOR_KEEPING_COMPILER_HAPPY
 *              which is used to tell the developer what's up
 * 2013.01.XX - Released by M-PLIFY S.A. under the MIT License              
 * 2013.02.21 - Added "imply()" 
 * 2013.06.21 - Renamed "_check" to "Check" for consistency
 * 2014.01.19 - Added notNullAndLargerThanZero()
 * 2014.01.21 - Reorganized methods, special cases 1..3 args for 'isTrue()'
 *              and 'isFalse()' added
 * 2014.02.01 - Namespace changed from "com.mplify.checkers" to 
 *              "com.example" for some neutrality. Added more
 *              methods; cleaned things up, made more consistent.              
 ******************************************************************************/
<commit_msg>Updated comments<commit_after>package com.example;

import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/* 34567890123456789012345678901234567890123456789012345678901234567890123456789
 * *****************************************************************************
 * Copyright (c) 2010, M-PLIFY S.A.
 *                     68, avenue de la Liberté
 *                     L-1930 Luxembourg
 *
 * Released by M-PLIFY S.A. under the MIT License
 * ALl modifications since still under the MIT License   
 *******************************************************************************
 *******************************************************************************
 * Function for checking arguments of a method (or more generally doing
 * assert-like checks) and throwing accordingly.
 * 
 * This is practically the same as Guava's "Preconditions", see
 * 
 *    http://code.google.com/p/guava-libraries/wiki/PreconditionsExplained
 * 
 * But with methods for additional functionality.
 * 
 * For more complete approaches, see: 
 * 
 *    http://en.wikipedia.org/wiki/Design_by_contract
 *
 *    ...for Java and Groovy DbC facilities.
 *
 * What is being thrown 
 * --------------------
 * 
 * These functions throw "CheckFailedException" derived from RuntimeException
 * instead of "NullPointerException", "IllegalArgumentException" and
 * "IllegalStateException".
 *
 * Why: 
 * ----
 * 
 * "IllegalArgumentException" is meant to be thrown
 * during argument checks ("Thrown to indicate that a method has been passed 
 * an illegal or inappropriate argument."), but this is not consistently used.
 * 
 * "IllegalStateException" is meant to be thrown if the "state is incorrect".
 * ("Signals that a method has been invoked at an illegal or inappropriate 
 *  time. In other words, the Java environment or Java application is not
 *  in an appropriate state for the requested operation."), but this is not 
 * consistently used either.
 *  
 * As one is never sure whether "IllegalArgumentException" or
 * "IllegalStateException" should be thrown, just throw "CheckFailedException".
 * 
 * "NullPointerException" should mean that there is some uncaught problem
 * in resolving a reference, it should really not be thrown by methods that
 * check whether a reference is null.  
 *
 * Basically, I would like to see the three above only thrown from the default
 * Java libraries, and possibly third part libraries not from my own code.
 * 
 * How to import
 * -------------
 * 
 * Import this class statically:
 * 
 *    import static com.example.BasicChecks.*
 * 
 * Then call at will:
 * 
 *    Long res = callStuff();
 *    checkNotNull(x, "Long returned by callStuff()"):
 * 
 * Some methods return the object that was checked, so you may write:
 * 
 *    Long res = checkNotNull(callStuff(), "Long returned by callStuff()"):
 * 
 * I am sure this is more legible though.
 * 
 * --------------
 * 2010.11.25 - Created because bored to add multiliners to methods entries
 * 2011.02.16 - Added _isInstanceOf() taking multiple parameters
 * 2011.05.30 - Added _cannotHappen()
 * 2011.05.31 - Now throw CheckFailedException instead of IllegalArgumentException.
 *              Some rewrites and renames.
 * 2011.06.16 - Added fail()   
 * 2011.07.12 - formatForMe() has been moved to LogFacilities           
 * 2011.10.19 - Moved the package com.mplify.checkers to "01_ignition"
 *              because it's really used "very early".
 * 2011.11.29 - Added validate() to unify validation calls  
 * 2012.01.18 - In validateIt(): made sure that unreachable validate method
 *              does not throw up the stack     
 * 2012.07.17 - Added inRange() for longs
 * 2012.12.28 - Added NEVER_GET_HERE_BUT_NEEDED_FOR_KEEPING_COMPILER_HAPPY
 *              which is used to tell the developer what's up
 * 2013.01.XX - Released by M-PLIFY S.A. under the MIT License              
 * 2013.02.21 - Added "imply()" 
 * 2013.06.21 - Renamed "_check" to "Check" for consistency
 * 2014.01.19 - Added notNullAndLargerThanZero()
 * 2014.01.21 - Reorganized methods, special cases 1..3 args for 'isTrue()'
 *              and 'isFalse()' added
 * 2014.02.01 - Namespace changed from "com.mplify.checkers" to 
 *              "com.example" for some neutrality. Added more
 *              methods; cleaned things up, made more consistent.              
 ******************************************************************************/

{'fraction_non_alphanumeric': 0.1601876675603217, 'fraction_numerical': 0.05026809651474531, 'mean_word_length': 3.2471537001897532, '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': '6193321', 'n_tokens_mistral': 2759, 'n_tokens_neox': 2277, 'n_words': 859}